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

Parameters to UFL

+1 vote

I'm using ffc to generate .h file from a .ufl, in such a way that I can later include it into DOLFIN C++. I'd like to know if it is possible to pass some parameters to a .ufl file, for example the kind of the Finite Element I want to use (lagrange, RT, DG, ...). If it is not possible, can I "split" the different parts which compose a .ufl file ? For example 1 file for the element I use, 1 for the function and 1 for the variational form and then include all the three .h files into the .cpp files

asked Jun 24, 2013 by gedeone FEniCS User (1,110 points)
edited Jun 25, 2013 by Garth N. Wells

To the second question: you can't define form (and generate its code) without element. Maybe you can use import statements to scatter complete UFL code across different files.

1 Answer

+3 votes
 
Best answer

You cannot 'pass' parameters to a file (this isn't a UFL restriction, but general programming).

You could write a template-like file and fill in the arguments using some Python code. How to do this is a Python question rather than a FEniCS question.

answered Jun 27, 2013 by Garth N. Wells FEniCS Expert (35,930 points)
selected Jun 28, 2013 by Garth N. Wells

Ok thanks.
I was a little bit confused because we can compile the .ufl file, and so I was thinking to something like argc and argv in a c++ code, but as you said it is just a file and there isn't anything like a main or something.
Thanks for your help
Marco

...