adevs
|
#include <adevs_poly.h>
Public Member Functions | |
InterPoly (const double *u, const double *t, unsigned int n) | |
InterPoly (const double *u, double dt, unsigned int n, double t0=0.0) | |
void | setData (const double *u, const double *t=NULL) |
double | interpolate (double t) const |
double | operator() (double t) const |
double | derivative (double t) const |
~InterPoly () | |
This class implements Lagrange interpolating polynomials of arbitrary order for functions of a single variable. This can be useful in many discrete event simulations where tabular values, possible produced by discrete time calculations, need to be interpolated for use in a discrete event system. GDEVS is one particular example of this.
adevs::InterPoly::InterPoly | ( | const double * | u, |
const double * | t, | ||
unsigned int | n | ||
) |
Construct a polynomial to interpolate a function u(t). The u- values are the dependent variable and t- the independent variables.
adevs::InterPoly::InterPoly | ( | const double * | u, |
double | dt, | ||
unsigned int | n, | ||
double | t0 = 0.0 |
||
) |
Construct a polynomial to interpolate u(t) with data points that are regularly spaced in time from an offset t0
adevs::InterPoly::~InterPoly | ( | ) |
Destructor
double adevs::InterPoly::derivative | ( | double | t | ) | const |
Approximate the function derivative at t
double adevs::InterPoly::interpolate | ( | double | t | ) | const |
Get the interpolated value at t
double adevs::InterPoly::operator() | ( | double | t | ) | const |
Overloaded operator for the interpolate method
void adevs::InterPoly::setData | ( | const double * | u, |
const double * | t = NULL |
||
) |
Assign new values to the data set. If t is NULL, then only new u values will be assigned and the old t data is kept.