Table of Contents

Name

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

Synopsis

falcON/inc/public/bodyfunc.h

class bodiesfunc {
public:
bodiesfunc(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(bodies const&b, double const&time, const real*pars) const;
};

Description

bodiesfunc function objects are constructed from a bodiesfunc expression expr (see bodiesfunc(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 bodiesfunc expression expr was empty or invalid).
func() takes a set of bodies, time, and npar() parameters and returns a T, which MUST match with type(). Similarly the bodies 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.

Caveats

Because bodiesfunc relies on the C++ compiler to generate information and function, any syntax errors in the bodiesfunc(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

bodiesfunc(5falcON)

Author

Walter Dehnen

Update History


21-jul-2004 Created    WD
07-nov-2004 parameters added, changed cond#expr to expr@cond    WD
12-jul-2006 Updated    WD


Table of Contents