This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

From .ufl to .h

+1 vote

I'm trying to convert a Python code into a C++ one, so I need to generate an .h file from a .ufl file.
I write on the command line:

ffc -l dolfin Def.ufl

It looks ok and it works, but I have no clue about how to extract a functional from the .ufl file.
From the .ufl file

Energy = blablabla
F = derivative(F, u, v)
J = derivative(F, u, t)

I only get Def::ResidualForm and Def::JacobianForm.
How can I find Energy? Am I missing something?

asked Aug 21, 2015 by nicholas_ FEniCS Novice (310 points)

1 Answer

+1 vote

Try adding a line at the end of the ufl file like this

forms = [F, J, Energy]

Additional forms that you define can be added here and they will be then be accessible from the C++ code that includes the .h file

answered Aug 27, 2015 by david.bernstein FEniCS User (2,000 points)

Exactly. Or you can rename "Energy" to the default name for a functional which is "M".

...