Example:
#include<function3d.h>
...
class my_function: public Function3d<double,double>
{
public:
// data
double mx,my,mz,c;
// input and output
void Read(istream& stream) { stream >> mx >> my >> mz >> c; }
void Write(ostream& stream) const
{ stream << mx << ' ' << my << ' ' << mz << ' ' << c; }
// evaluation
double evaluate(const double& x, const double& y, const double& z)
{ return mx * x + my * y + mz * z + c; }
};
The method `()' is defined to evaluate the function, e.g.
my_function f1; cin >> f1; // read parameters double x,y,z; cin >> x >> y >> z; // read argument double f = f1(x,y,z); cout << f << endl; // evaluate function
Function3d<double,double&ht;
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.
Realfunction3d_1dproductRealfunction1ds.
#include<function3d.h> ... Realfunction3d_1dproduct p; cin >> p; double x,y,z; cin >> x >> y >> z; double f = p(x,y,z); cout << f << endl;
Realfunction3d_2dinterpRealfunction2d)
to use at that value,
followed by three integers describing the mapping between the arguments of
the 3D function and the 2D function.
The result is interpolated between the nearest pair of functions.
The mapping is a set of indices whose position relates to the 3D argument,
and whose value defines the position in the 2D argument.
Position "0" refers to the ordinate controlling which pair of functions
is used for the interpolation.
Positons "1" and "2" refer to the first and second arguments of the 2D
function.
Realfunction3d_sumnumber_of_functions For each: fiEach
fi is a Realfunction3d.
Realfunction3d_offsetx0 y0 z0 f
f is a Realfunction3d.
Realfunction3d_mapxmap ymap zmap fmap f
xmap, ymap, zmap and fmap
are Realfunction1ds.
f is a Realfunction3d.