Function<Vector,double>
.
A generic write-with-switch is provided for writing pointered
polymorphic subclasses.
The corresponding read-with-switch is provided for groups of functions
in the library.
To use, define a pointer to an instance of the appropriate class. Data in an input stream must first specify the class identifier (the name, with lowercase first character) then the data. When writing to an output stream, the identifier is written followed by the data. Example:
#include<functionnd.h> int main() { Realfunctionnd *f; cin >> f; Vector r; cin >> r; cout << "f(r) = " << (*f)(r) << endl; }
Realfunction1d
s.
Realfunction1d
and the component index (base 0)
which the function acts on.
Realfunction2d
and the two component indices (base 0)
which the function acts on.
Realfunction3d
and the three component indices (base 0)
which the function acts on.
Realfunctionnd
s.
Realfunctionnd
s.
r0
and a Realfunctionnd
f
.
Evaluating the function with an argument (vector) r
produces f(r-r0)
.
Realfunction1d
s, rmap
, one for each
spatial dimension, another Realfunction1d
, fmap
,
for the function return value,
and a Realfunctionnd
f
.
Evaluating the function with an argument (vector) r
,
a modified vector r'
is calculated,
where each of its components is found from the corresponding component of
r
using the corresponding function from rmap
:r'[i] = rmap[i](r[i])
.fmap(f(r'))
.
Among many other applications, this class is useful for re-scaling variables.