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

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 16 Aug 2005 15:53:33 +0200

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

---

From: <[email-masked]>
Date: Wed, 17 Aug 2005 04:50:25 -1100

Garth, Thanks for looking into this -- I will fix this later
this afternoon or tomorrow.  I'm tied up for the next several
hours.

Rob

---- Original message ----
>Date: Wed, 17 Aug 2005 09:15:33 +0200
>From: "Garth N. Wells" <[email-masked]>  
>Subject: [FIAT-dev] Re: [FFC-dev] Problem with vector
constants (more the 3 components)  
>To: Anders Logg <[email-masked]>
>Cc: Discussion of FFC development <[email-masked]>,
[email-masked]
>
>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]>:
>
>> Could be either FFC or FIAT. The error message says
>> 
>> > > self.table[element][cindex[0]][dorde r][dindex][vindex]
>> 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
>> 
>> Looks lOn Tue, Aug 16, 2005 at 06:07:05PM +0200, Garth N.
Wells wrote:
>> > This apperas to be a different problem. The constant
scalar case is fine
>> now. 
>> > 
>> > Garth
>> > 
>> > 
>> > Quoting [email-masked]:
>> > 
>> > > 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
>> > > >  File
"/usr/lib/python2.4/site-packages/ffc/compiler/compiler.py",
>> > > line 42, in
>> > > >  File
"/usr/lib/python2.4/site-packages/ffc/compiler/compiler.py",
>> > > line 93, in
>> > > >  File
"/usr/lib/python2.4/site-packages/ffc/compiler/elementtensor.py",
>> > > line
>> > > >  File
"/usr/lib/python2.4/site-packages/ffc/compiler/term.py", line
>> > > 19, in __init__
>> > > >  File
"/usr/lib/python2.4/site-packages/ffc/compiler/referencetensor.py",
>> > > line
>> > > >  File
"/usr/lib/python2.4/site-packages/ffc/compiler/referencetensor.py",
>> > > line
>> > > >  File
"/usr/lib/python2.4/site-packages/ffc/compiler/integrator.py",
>> > > line 113,
>> > > >in __call__
>> > > >    value =
>> > > self.table[element][cindex[0]][dorder][dindex][vindex]
>> > > >_______________________________________________
>> > > >FFC-dev mailing list
>> > > >[email-masked]
>> > > >http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
>> > > 
>> > 
>> > _______________________________________________
>> > FFC-dev mailing list
>> > [email-masked]
>> > http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
>> > 
>> 
>> -- 
>> Anders Logg
>> Research Assistant Professor
>> Toyota Technological Institute at Chicago
>> http://www.tti-c.org/logg/
>> 
>> _______________________________________________
>> FFC-dev mailing list
>> [email-masked]
>> http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
>> 
>________________
>P0_patch (3k bytes)
>________________
>_______________________________________________
>FIAT-dev mailing list
>[email-masked]
>http://www.fenics.org/cgi-bin/mailman/listinfo/fiat-dev