dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #09976
Function evaluation
User-defined functions are currently defined by overloading eval().
The eval() function is available in two different versions, for vectors
(tensors) and scalars:
void eval(double* values, const double* x) const;
double eval(const double* x) const;
This might be ok, but functions may also depend on the current cell,
the current facet, and perhaps on the current time and other data.
These are accessible by this->cell, this->facet.
So, a function depends on x and other things and it's not obvious what
additional data a function does depend on. Are there any suggestions
for what the interface should look like for user-defined functions?
One option could be to let functions be defined by expressions
(function pointers) given to the constructor of Function. That way,
one could define a function by
void source(const double* x) { sin(x[0]); }
f = Function(mesh, source);
This way, there could be many different types of function pointers,
all taking a different number of arguments, and we could differentiate
between the different types.
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups