← Back to team overview

ffc team mailing list archive

restriction on constants

 


Hi,

Is there a reason for constants to be restricted to ('+/-') as default?

The reason I'm asking is the following:

If compiling

element = FiniteElement("Lagrange", "triangle", 1)
v = TestFunction(element)
c = Constant("triangle")

L = dot(grad(v),grad(c))*dx

using tensor contraction the result is correct since the values in the reference
tensor for the grad(c) part will all be zero -> no code generated -> no need for
Jinv*_**

If compiling the same form with quadrature, the resulting *.h file cannot be
compiled with DOLFIN because quadrature has no concept of tracking zeros at
compile time -> generate code -> where Jinv*_** is needed.

This causes a problem since the default restriction for a constant transform is
"0", so e.g. Jinv0_00 will be needed, but since we're integrating over 'dx' the
jacobian code snippet only (and so it should) contains Jinv_** terms which will
lead to a c++ compile error.

So it would be nice to return to the old definition of Constant() for which I
think there was no restriction, or make the default restriction for constant (in
ufcformat.py) equal to that of None i.e. ""

Or maybe there's a reason for these restrictions so I should come up with
another solution?

Kristian



Follow ups