Subject: Re: [FFC-dev] Problem with vector constants (more the 3 components)

From: <[email-masked]>
Date: Tue, 16 Aug 2005 05:01:33 -1100

Is this related to the problem we had with constant scalar
Lagrange, or is this some FFC problem?

Rob

---- Original message ----
>Date: Tue, 16 Aug 2005 15:53:33 +0200
>From: "Garth N. Wells" <[email-masked]>  
>Subject: [FFC-dev] Problem with vector constants (more the 3
components)  
>To: [email-masked]
>
>An error message is returned with constant vector functions
when the number of
>vector components exceeds the spatial dimension. There seems
to be no problem
>with higher order functions. Below are some details and an
example.
>
>Garth 
>
>
>
>element = FiniteElement("Vector Lagrange", "triangle", 1)
>stress_basis  = FiniteElement("Discontinuous vector
Lagrange", "triangle", 0, 3)
>
>stress = Function(stress_basis) 
>
>v = BasisFunction(element)
>L = stress[2]*v[0].dx(0) *dx 
> 
>returns an error for constant "stress_basis". The error is 
>
>
>
>Traceback (most recent call last):
>  File "/usr/bin/ffc", line 81, in ?
>    main(sys.argv[1:])
>  File "/usr/bin/ffc", line 59, in main
>    execfile(outname)
>  File "test.py", line 33, in ?
>    compile([a, L], name, "C++", "GNU GPL Version 2")
>  File
"/usr/lib/python2.4/site-packages/ffc/compiler/compiler.py",
line 42, in
>compile
>    forms = build(sums, name, language)
>  File
"/usr/lib/python2.4/site-packages/ffc/compiler/compiler.py",
line 93, in
>build
>    form.AKi = ElementTensor(form.sum, "interior", format)
>  File
"/usr/lib/python2.4/site-packages/ffc/compiler/elementtensor.py",
line
>37, in __init__
>    self.terms = [Term(p) for p in sum.products if
p.integral.type == type]
>  File
"/usr/lib/python2.4/site-packages/ffc/compiler/term.py", line
19, in __init__
>    self.A0 = ReferenceTensor(product)
>  File
"/usr/lib/python2.4/site-packages/ffc/compiler/referencetensor.py",
line
>58, in __init__
>    self.A0 = self.__compute_reference_tensor()
>  File
"/usr/lib/python2.4/site-packages/ffc/compiler/referencetensor.py",
line
>121, in __compute_reference_tensor
>    integral += integrate(self.basisfunctions, i, a, b)
>  File
"/usr/lib/python2.4/site-packages/ffc/compiler/integrator.py",
line 113,
>in __call__
>    value =
self.table[element][cindex[0]][dorder][dindex][vindex]
>IndexError: list index out of range
>
>_______________________________________________
>FFC-dev mailing list
>[email-masked]
>http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 16 Aug 2005 18:07:05 +0200

This apperas to be a different problem. The constant scalar case is fine now. 

Garth

---

From: Anders Logg <[email-masked]>
Date: Tue, 16 Aug 2005 13:39:36 -0500

Could be either FFC or FIAT. The error message says

> > >IndexError: list index out of range

which means that either FFC is indexing the table wrong or FIAT is not
computing the correct table (tabulate_jet). I'm traveling this week
and the next so I will probably not have time to debug until I return
to Chicago.

/Anders

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/

---

From: "Garth N. Wells" <[email-masked]>
Date: Wed, 17 Aug 2005 09:15:33 +0200

It looks like it was a FIAT problem in P0.py (and DiscontinuousLagrange.py). For
a constant vector, the number of components was equal to the spatial dimension
by default. Attached is a very short patch (3 lines) which seems to fix the problem.

Garth 

Quoting Anders Logg <[email-masked]>:

> > > self.table[element][cindex[0]][dorde r][dindex][vindex]

---

From: Anders Logg <[email-masked]>
Date: Thu, 18 Aug 2005 03:53:01 -0500

Great! I suspected it was a FIAT bug rather than FFC... ;-)

/Anders