ffc team mailing list archive
-
ffc team
-
Mailing list archive
-
Message #01759
derivatives of constants
Hi,
I think we've addressed this before, but I'm not sure when and what the outcome
was. The following 3 forms all result in the same code apart from some variable
names:
element = FiniteElement("Lagrange", "triangle", 1)
v = TestFunction(element)
u = TrialFunction(element)
f = Function(element)
c = Constant("triangle")
a = c*dot(grad(v), grad(u))*dx # 0
a = dot(grad(v), mult(c, grad(u)))*dx # 1
a = dot(grad(v), grad(c*u))*dx # 2
The first two forms are basically identical. However, the latter results in 2
monomial terms that FFC must consider. This is obviously a waste of time since
one evaluates to zero anyway. Should analyze.py or something else pick this up?
How will this be dealt with in UFL? Or should it be handled in the compilers?
Kristian
Follow ups