← Back to team overview

dolfin team mailing list archive

Re: Function evaluation

 

How exactly would this take into account the current time-step of the simulation (for example)? Wouldn't the user still have to overload something?

Actually, I'm not completely clear on what you are trying to do. Are you trying to hide some of the implementation details of cell facets, and other things? Is this really necessary?

- Shawn

On Fri, 3 Oct 2008, Anders Logg wrote:

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



Follow ups

References