← Back to team overview

ffc team mailing list archive

Adding/subtracting mixed functions

 

I'm getting an error when trying something really simple with FFC. Compiling

    U       = VectorElement("Lagrange", "triangle", 2)
    C       = FiniteElement("Lagrange", "triangle", 2)
    element = U + C

    (v, c)  = Functions(element)
    v_h     = Function(U)

    e = v - v_h

leads to

Traceback (most recent call last):
  File "/usr/bin/ffc", line 221, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ffc", line 104, in main
    execfile(script, {})
  File "Error.py", line 37, in <module>
    e = v - v_h
File "/usr/lib/python2.5/site-packages/ffc/compiler/language/algebra.py", line 73, in __rsub__
    return Form(-self) + other
File "/usr/lib/python2.5/site-packages/ffc/compiler/language/algebra.py", line 645, in __add__
    w1 = Form(other)
File "/usr/lib/python2.5/site-packages/ffc/compiler/language/algebra.py", line 635, in __init__ raise FormError, (other, "Unable to create Form from given expression.")
ffc.common.exceptions.FormError


If I do

    U       = VectorElement("Lagrange", "triangle", 2)
    C       = FiniteElement("Lagrange", "triangle", 2)
    element = U + C

    v       = Function(U)
    v_h     = Function(U)

    e = v - v_h

it works fine. Is this an obvious bug to fix?

Garth


Follow ups