← Back to team overview

dolfin team mailing list archive

Expressions without elements

 

Here's an issue I've run into lately.

The current design of the Expression class forces the specification
of a FunctionSpace or UFL FiniteElement when one creates an Expression:

  v = Expression("sin(x[0])", V=V)  or
  v = Expression("sin(x[0])", element=element)

This is only necessary in Python, but not in C++ where it's enough to
set the geometric dimension.

Would it be possible to add an optional constructor that just takes
the geometric dimension as an argument?

I'm writing some code where I create various Expressions and project
to different function spaces (for some theoretical studies related to
adaptivity). Then it shouldn't matter (and it doesn't) which function
space or element I originally specify in the constructor of my sin(x)
expression.

If necessary, we can automatically create either a piecewise linear
Lagrange element based on the incoming geometric dimension. Another
option would be to use a QuadratureElement.

--
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups