Table of Contents


bodyfunc - functions taking body, time, and a set of parameters and returning bool, int, real, or vector.



class bodyfunc {
bodyfunc(const char* expr) throw(falcON::exception);
char const& type() const;
fieldset const& need() const;
int const& npar() const;
bool is_empty() const;
template<typename T>T func(body const&b, double const&time, const real*pars) const;


bodyfunc function objects are constructed from a bodyfunc expression expr (see bodyfunc(5falcON) ) by envoking the C++ compiler.
type() returns ’b’, ’i’, ’r’, or ’v’ for boolean, integer, real (scalar) or vector being the return type of func() as determined from the bodyfunc expression expr.
npar() returns the number of parameter required by the member function func.
need() returns the N-body data required by func().
is_empty() returns true if the function is not defined (e.g. because the bodyfunc expression expr was empty or invalid).
func() takes a body, time, and npar() parameters and returns a T, which MUST match with type(). Similarly the body MUST support the data indicated by need(). Note that usually neither type nor data need are checked, unless when compiled for debugging). In case of an empty function, ’true’, 0, 0., or (0,0,0) are returned for boolean, integer, real, or vector return type, respectively.


Because bodyfunc relies on the C++ compiler to generate information and function, any syntax errors in the bodyfunc(5falcON) expression will result in compiler errors and are not analysed and reported in any detail. The experienced user may inspect the C++ source code and the compiler output, which are reported to stderr if debug>=2.

See Also



Walter Dehnen

Update History

21-jul-2004 Created    WD
12-jul-2006 Updated    WD

Table of Contents