YANE-Framework 1.1.0
Public Member Functions | Protected Member Functions | Protected Attributes

yane::OdeSolve::DoPri853 Class Reference

Class of the Dormand-Prince8(5)3 solver for differential equation systems.

Inheritance diagram for yane::OdeSolve::DoPri853:
[legend]
Collaboration diagram for yane::OdeSolve::DoPri853:
[legend]

List of all members.

Public Member Functions

virtual int acceptedSteps ()
 Function to obtain the number of accepted steps of the solver.
void calc (double t, double *rpar=0, int *ipar=0)
 Function to compute the solution of the dynamic.
virtual OdeSolveFirstclone ()
 Function to construct a clone of the object derived from the class yane::OdeSolve::OdeSolve.
virtual int computedSteps ()
 Function to obtain the number of computed steps of the solver.
 DoPri853 ()
 Constructor.
virtual int functionEvalCount ()
 Function to obtain the number of function evaluations.
void init (double t0, double *y0)
 Function to set the initial values for the differential or difference equation system solver.
void refreshConfig ()
 Function to refresh the configuration of the object.
virtual int rejectedSteps ()
 Function to obtain the number of rejected steps of the solver.
void reset (OdeFunction *func, OdeConfig *config)
 Function to initialize the object.
void resize (int dimension)
 Function to change the size of the dynamic of the system.

Protected Member Functions

virtual void abstractCalc (double t, double *rpar, int *ipar)
 Function to abstract the computation of the solution of the differential equation or difference equation.
virtual void assertConfig ()
 Function to check the configuration of the object.
virtual void assertMemory ()
 Function to abstract the allocation of memory which are required by object classes derived from this class.
virtual void assertValidDGL (OdeFunction *dgl)
 Function to check whether the current differential equation or difference equation can be solved by the yane::OdeSolve::OdeSolve object.

Protected Attributes

double _atol
 Absolute error tolerance.
double * _atol_vec
 Vector of absolute error tolerances.
OdeConfig_config
 Pointer of the configuration object.
yane::Utils::Uuid_config_id
 Pointer for configuration identifier.
int _did
 Error flag:

  • $ did = 1 $ Successful termination
  • $ did = 2 $ Successful termination with output via yane::OdeSolve::OdeSolve::_solout
  • $ did = -1 $ Input data is inconsistent
  • $ did = -2 $ Maximal number of steps reached
  • $ did = -3 $ Step size became too small
  • $ did = -4 $ Problem seems to be too stiff.

int _dimension
 Dimension of the state variable of the system.
void(* _dopri_func )(int *n, yane::OdeSolve::T_ODEFUNC FCN, double *x, double *y, double *xend, double *rtol, double *atol, int *itol, yane::OdeSolve::T_SOLOUTFUNC solout, int *iout, double *work, int *lwork, int *iwork, int *liwork, double *rpar, int *ipar, int *did)
 Prototype for calling the Dormand-Prince differential equation solver.
OdeFunction_func
 Pointer of the differential or difference equation.
bool _initial_value_set
 Decision variable to check if an initial value has been assigned.
int _itol
 Decision variable

  • $ itol = 0 $ Scalar error tolerances
  • $ itol \geq 0 $ Vector error tolerances.

int * _iwork
 Array for integer variables.
int _liwork
 Size of array for integer variables.
int _lwork
 Size of array for double variables.
T_ODEPARAMS _paramdata
 Structure of differential equation or difference equation data.
double _rtol
 Relative error tolerance.
double * _rtol_vec
 Vector of relative error tolerances.
double _t
 Current time instance.
double * _work
 Array for double variables.
double * _y
 Current state vector.

Member Function Documentation

LIB_EXPORT void yane::OdeSolve::DoPri::abstractCalc ( double  t,
double *  rpar,
int *  ipar 
) [protected, virtual, inherited]
Parameters:
tTerminal time for solving the differential or difference equation problem
rparArray of double parameters
iparArray of integer parameters
Exceptions:
NoInitialValueExceptionIs thrown if no initial value has been supplied
WrongSolverInputExceptionIs thrown if parameters are incorrect
TooManyStepsExceptionIs thrown if the maximal allowed number of steps is reached
TooSmallStepSizeExceptionIs thrown if the current step size becomes too small
StiffExceptionIs thrown if the system appears to be too stiff for the solver
yane::Utils::NotInitializedExceptionIs thrown if the solver has not been initialized

Implements yane::OdeSolve::OdeSolve.

LIB_EXPORT int yane::OdeSolve::DoPri::acceptedSteps ( ) [virtual, inherited]
Returns:
Number fo accepted steps

Implements yane::OdeSolve::OdeSolve.

LIB_EXPORT void yane::OdeSolve::DoPri::assertValidDGL ( OdeFunction dgl) [protected, virtual, inherited]
Exceptions:
IncompatibleDGLExceptionIs thrown if the current differential equation or difference equation cannot be solved by the yane::OdeSolve::OdeSolve object

Reimplemented from yane::OdeSolve::OdeSolve.

LIB_EXPORT void yane::OdeSolve::OdeSolve::calc ( double  t,
double *  rpar = 0,
int *  ipar = 0 
) [inherited]

This function solves the differential or difference equation problem up to a supplied time instant. Internally, the function calls the function yane::OdeSolve::OdeSolve::abstractCalc which is given by the solver supplied to this object.

Parameters:
tTerminal time for solving the differential or difference equation problem
rparArray of double parameters
iparArray of integer parameters
Exceptions:
noInitialValueExceptionIs thrown if no initial value has been supplied
yane::Utils::NotInitializedExceptionIs thrown if the solver has not been initialized
LIB_EXPORT yane::OdeSolve::OdeSolveFirst * yane::OdeSolve::DoPri853::clone ( ) [virtual]

This abstract function clone the object derived from the yane::OdeSolve::OdeSolve. Note that the new instance is constructed but not initialized. Hence, the function yane::OdeSolve::OdeSolve::reset and yane::OdeSolve::OdeSolve::init must be called prior to using this object. In a similar manner, the user must delete this object himself. It is not delete if the object which has been cloned is deleted.

Returns:
Clone of the object

Implements yane::OdeSolve::OdeSolveFirst.

LIB_EXPORT int yane::OdeSolve::DoPri::computedSteps ( ) [virtual, inherited]
Returns:
Number of computed steps

Implements yane::OdeSolve::OdeSolve.

LIB_EXPORT int yane::OdeSolve::DoPri::functionEvalCount ( ) [virtual, inherited]
Returns:
Number of function evaluations

Implements yane::OdeSolve::OdeSolve.

LIB_EXPORT void yane::OdeSolve::OdeSolveFirst::init ( double  t0,
double *  y0 
) [inherited]
Parameters:
t0Initial time
y0Initial state vector. On exit, this variable contrains the solution at the terminal time instance.
Exceptions:
yane::Utils::NotInitializedExceptionIs thrown if the solver has not been initialized
LIB_EXPORT void yane::OdeSolve::OdeSolve::refreshConfig ( ) [inherited]

This function refreshed the configuration of the object. This may be necessary if the user cannot be sure that data within the yane::OdeSolve::OdeConfig object have been changed since the last call of yane::OdeSolve::OdeSolve::reset. Hence, this data should be handed over to the solver.
The function checks if the configuration has been changed and refreshes it using the internal function yane::OdeSolve::OdeSolve::assertConfig.

Exceptions:
yane::Utils::NotInitializedExceptionIs thrown if the solver has not been initialized
LIB_EXPORT int yane::OdeSolve::DoPri::rejectedSteps ( ) [virtual, inherited]
Returns:
Number of rejected steps

Implements yane::OdeSolve::OdeSolve.

LIB_EXPORT void yane::OdeSolve::OdeSolve::reset ( OdeFunction func,
OdeConfig config 
) [inherited]

This function initializes the object and provides the dynamic of the system as well as the configuration. The size of the problem is set according to the data contained in the OdeFunction object.

Parameters:
funcPointer of the dynamic of the system
configPointer of the configuration object
Exceptions:
yane::Utils::MemoryExceptionIs thrown if the memory allocation failed
WrongSolverInputExceptionIs thrown if a null pointer is provided to the routine
OdeSolExIs thrown if an error occured during the allocation or configuration of the differential equation solver
IncompatibleConfigExceptionIs thrown if an error occured during the configuration of the differential equation solver
See also:
OdeFunction
resize
LIB_EXPORT void yane::OdeSolve::OdeSolve::resize ( int  dimension) [inherited]

This function can be used to efficiently change the size of the dynamic of the system. The size of the dynamic must ont be larger than the dimension of the problem set within the yane::OdeSolve::OdeFunction object. Note that the object must be initialized with a call of yane::OdeSolve::OdeSolve::reset and that calling this method results in an update of the configuration of the object.

See also:
OdeFunction
reset
Parameters:
dimensionNew size of the dynamic of the problem
Exceptions:
WrongSolverInputExceptionIs thrown if the new size or the system is too large or less or equal to zero
yane::Utils::NotInitializedExceptionIs thrown if the solver has not been initialized

Member Data Documentation

void( * yane::OdeSolve::DoPri::_dopri_func)(int *n, yane::OdeSolve::T_ODEFUNC FCN, double *x, double *y, double *xend, double *rtol, double *atol, int *itol, yane::OdeSolve::T_SOLOUTFUNC solout, int *iout, double *work, int *lwork, int *iwork, int *liwork, double *rpar, int *ipar, int *did) [protected, inherited]
Parameters:
nDimension of the state
FCNPointer of the differential equation
xInitial time
yInitial value of the state
xendTerminal time
rtolRelative tolerance
atolAbsolute tolerance
itolDecision variable

  • $ itol = 0 $ Scalar error tolerances
  • $ itol \geq 0 $ Vector error tolerances
soloutOutput function for continuous time output
ioutOutput parameter

  • $ iout \geq 1 $ Output of the state vector for every accepted step
  • $ iout = 0 $ No output, dummy function required
workreservierter Arbeitsspeicher für double-Werte
workWorking array for double variables
lworkSize of working array for double variables
iworkWorking array for integer variables
liworkSize of working array for integer variables
rparArray for double parameters
iparArray for integer parameters
didError flag:

  • $ _did = 1 $ Successful termination
  • $ _did = 2 $ Successful termination with output via yane::OdeSolve::OdeSolve::_solout
  • $ _did = -1 $ Input data is inconsistent
  • $ _did = -2 $ Maximal number of steps reached
  • $ _did = -3 $ Step size became too small
  • $ _did = -4 $ Problem seems to be too stiff