← Back to team overview

ffc team mailing list archive

Check tensor notation for completeness. [...]

 

Commit from logg (2005-11-17 23:38 CET)
----------------

Check tensor notation for completeness.

Andy Terrel discovered a pretty serious bug in the FFC form language
that allows forms that are not complete with respect to the FFC
tensor notation to be compiled and generate wrong results.

Forms are now checked for completeness before compilation, that is,
summation indices in each term of a form must be repeated exactly twice.
All current demo forms in FFC pass the new test.

Here's a simple example that does not compile properly:

element = FiniteElement("Lagrange", "triangle", 1)

v = BasisFunction(element)
u = BasisFunction(element)
f = Function(element)

g = f*f
L = v*g*g*dx

The problem is that while indices are generated correctly for the basis
expansion of the product g = f*f, they are not generated correctly
for the product g*g (but are just repeated).

As a next step, I will make use of the new completeness test to generate
correct indices for this and similar forms.

  ffc  ChangeLog                            1.97
  ffc  src/ffc/compiler/algebra.py          1.24
  ffc  src/ffc/compiler/reassign.py         1.8
  ffc  src/ffc/compiler/referencetensor.py  1.15
  ffc  src/ffc/compiler/tokens.py           1.6