#include <Ode.h>
Inherits Base.
Inheritance diagram for Ode:

Public Types | |
| CURRENT = 0 | |
| MAXIMUM | |
| VARIABLE | |
| enum | VTYPE { CURRENT = 0, MAXIMUM, VARIABLE, VTYPE_CNT } |
| VTYPE_CNT | |
Public Member Functions | |
| yType * | eval (yType *y, xType x1, xType x2, xType dx) throw (OdeErr) |
| int | getCount (enum Ode< xType, yType >::VTYPE vType) const |
| void | getDerivative (yType *dy, yType *y, xType x) const |
| xType | getError (void) const |
| Ode (const Ode &od) | |
| Ode (void(&pFn)(yType *, yType *, xType), xType dEps, int nVar) | |
| bool | setCount (int nMaximum) |
| bool | setEpsilon (xType dEps) |
| ~Ode (void) | |
Static Public Attributes | |
| static const int | DEF_LOOP_MAX = 10000 |
| static const int | STEP_CNT = 6 |
This class template integrates user-defined ordinary differential equations (ode) using a fifth-order Cash-Karp embedded Runge-Kutta method with fourth-order evaluations to estimate error.
The declaration typename <xType> specifies the form of independent variables used in integration calculations. The declaration typename <yType> specifies the form of solution variables used in integration calculations. In general, the <yType> variables should be the equal or superset of the <xType> variables.
See the cited References to obtain more information on the mathematical theory applied here.
| enum VTYPE |
Enumeration indicates the variable index of the integer value.
| Ode | ( | void(&)(yType *, yType *, xType) | rFn, | |
| xType | dEps, | |||
| int | nVar | |||
| ) |
Constructor initializes an ordinary differential equation integration object.
| rFn | a reference to a derivative evaluation function | |
| dEps | required error of the calculated integral (|y| units) | |
| nVar | number of integration variables |
void fn(yType *dy, yType *y, xType x); yType dy[nVar], y[nVar]; Copy constructor initializes an ordinary differential equation integration object from the specified existing integration object.
| od | a reference to an ordinary differential equation integration object |
| ~Ode | ( | void | ) |
Destructor frees allocated memory.
| yType * eval | ( | yType * | y, | |
| xType | x1, | |||
| xType | x2, | |||
| xType | dx | |||
| ) | throw (OdeErr) |
Function integrates the defined ordinary differential equation using 5th-order Cash-Karp embedded Runge-Kutta equations with 4th-order evaluation to estimate error.
| x1 | starting bound for independent variable (x units) | |
| x2 | ending bound for independent variable (x units) | |
| dx | step size initialization value (x units) | |
| y | a pointer to an initialized starting values array for the dependent variables evaluated at point x1; these values are overwritten with the calculated ending values array for dependent variable evaluated at point x2 (y units) |
| OdeErr | type of object thrown
|
yType y[nVar]; Function returns variable information or loop information pertaining to algorithm iterations.
| vType | variable index indentifying the type of data |
| void getDerivative | ( | yType * | dy, | |
| yType * | y, | |||
| xType | x | |||
| ) | const |
Function evaluates the user specified derivative function at the specified x and y values.
| x | value at which to evaluate the differential equation (x units) | |
| y | a pointer to an array of dependent values which define the differential equation at value x (y units) | |
| dy | a pointer to the calculated derivatives of y values at value x (y units/x units) |
yType dy[nVar]; yType y[nVar]; | xType getError | ( | void | ) | const |
Function returns the current error criterion used in the integration evaluation.
| bool setCount | ( | int | nMaximum | ) |
Function sets the current maximum loop count used in the integration evaluation.
| nMaximum | the maximum loop count value |
| bool setEpsilon | ( | xType | dEps | ) |
Function sets the current fractional error criterion used in the integration evaluation.
| dEps | fractional error tolerance of the integration values (|y| units) |
const int DEF_LOOP_MAX = 10000 [static] |
default maximum iteration loop count
const int STEP_CNT = 6 [static] |
Runge-Kutta algorithm step count value
1.4.7