Example:
#include<function2d.h> ... class my_function: public Function2d<double,double> { public: // data double mx,my,c; // input and output void Read(istream& stream) { stream >> mx >> my >> c; } void Write(ostream& stream) const { stream << mx << ' ' << my << ' ' << c; } // evaluation double evaluate(const double& x, const double& y) { return mx * x + my * y + c; } };
The method `()' is defined to evaluate the function, e.g.
my_function f1; cin >> f1; // read parameters double x,y; cin >> x >> y; // read argument double f = f1(x,y); cout << f << endl; // evaluate function
Function2d<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.
Realfunction2d_1dproduct
Realfunction1d
.
#include<function2d.h> ... Realfunction2d_1dproduct p; cin >> p; double x,y; cin >> x >> y; double f = p(x,y); cout << f << endl;
Realfunction2d_1dinterp_1
Realfunction1d
)
to use at that value.
The result is interpolated between the nearest pair of functions.
Realfunction2d_1dinterp_2
Realfunction1d
)
to use at that value.
The result is interpolated between the nearest pair of functions.
Realfunction2d_table
nx ny (dimensions of table) For each x: xi (x-ordinates) For each y: yj (y-ordinates) For each x: For each y: fi,j (function values)
#include<function2d.h> ... Realfunction2d_table t; cin >> t; double x,y; cin >> x >> y; double f = t(x,y); cout << f << endl; // evaluate function
Realfunction2d_table_bipoly
xorder yorder (order of polynomials used to interpolate in x and y) xfirst (1/0 for interpolation in x first/second)
Realfunction2d_sum
number_of_functions For each: fiEach
fi
is a Realfunction2d
.
Realfunction2d_product
number_of_functions For each: fiEach
fi
is a Realfunction2d
.
Realfunction2d_offset
x0 y0 f
f
is a Realfunction2d
.
Realfunction2d_map
xmap ymap fmap f
xmap
, ymap
and fmap
are
Realfunction1d
s.
f
is a Realfunction2d
.