Abstract base class for all kinds of algorithms for integrating differential equations (ODEs or DAEs). More...
#include <integrator.hpp>
Abstract base class for all kinds of algorithms for integrating differential equations (ODEs or DAEs).
The class Integrator serves as an abstract base class for all kinds of algorithms for integrating differential equations (ODEs or DAEs).
Definition at line 61 of file integrator.hpp.
Default constructor.
Definition at line 56 of file integrator.cpp.
Integrator::Integrator | ( | const Integrator & | arg | ) |
Copy constructor.
Definition at line 131 of file integrator.cpp.
Integrator::~Integrator | ( | ) | [virtual] |
Default destructor.
Definition at line 139 of file integrator.cpp.
BooleanType Integrator::canHandleImplicitSwitches | ( | ) | const [virtual] |
Returns if integrator is able to handle implicit switches.
Definition at line 459 of file integrator.cpp.
virtual Integrator* Integrator::clone | ( | ) | const [pure virtual] |
The (virtual) copy constructor
Implemented in IntegratorDiscretizedODE, IntegratorBDF, IntegratorLYAPUNOV, IntegratorRK, IntegratorLYAPUNOV45, IntegratorRK23, IntegratorRK45, IntegratorRK78, and IntegratorRK12.
returnValue Integrator::deleteAllSeeds | ( | ) | [virtual] |
Deletes all seeds that have been set with the methods above.
This function will also give the corresponding memory free.
Definition at line 488 of file integrator.cpp.
returnValue Integrator::diffTransitionBackward | ( | DVector & | DX, |
DVector & | DP, | ||
DVector & | DU, | ||
DVector & | DW, | ||
int & | order | ||
) | [protected, virtual] |
Definition at line 542 of file integrator.cpp.
returnValue Integrator::diffTransitionForward | ( | DVector & | DX, |
const DVector & | DP, | ||
const DVector & | DU, | ||
const DVector & | DW, | ||
const int & | order | ||
) | [protected, virtual] |
Definition at line 521 of file integrator.cpp.
virtual returnValue Integrator::evaluate | ( | const DVector & | x0, |
const DVector & | xa, | ||
const DVector & | p, | ||
const DVector & | u, | ||
const DVector & | w, | ||
const Grid & | t_ | ||
) | [protected, pure virtual] |
Starts integration: cf. integrate(...) for
more details.
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
t_ | the time interval |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
virtual returnValue Integrator::evaluateSensitivities | ( | ) | [pure virtual] |
Implemented in IntegratorRK, IntegratorBDF, and IntegratorLYAPUNOV.
returnValue Integrator::evaluateTransition | ( | const double | time, |
DVector & | xd, | ||
const DVector & | xa, | ||
const DVector & | p, | ||
const DVector & | u, | ||
const DVector & | w | ||
) | [protected, virtual] |
Evaluates the transtion (protected, only for internal use).
time | the time |
xd | the state |
xa | the algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 505 of file integrator.cpp.
virtual returnValue Integrator::freezeAll | ( | ) | [pure virtual] |
Freezes the mesh as well as all intermediate values. This function
is necessary for the case that automatic differentiation in backward
mode should is used. (Note: This function might for large right hand
sides lead to memory problems as all intemediate values will be
stored!)
Implemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
virtual returnValue Integrator::freezeMesh | ( | ) | [pure virtual] |
Freezes the mesh: Storage of the step sizes. If the integrator is
freezed, the mesh will be stored when calling the function integrate
for the first time. If the function integrate is called more than
once the same mesh will be reused (i.e. the step size control will
be turned off). Note that the mesh should be frozen if any kind of
sensitivity generation is used.
Implemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
returnValue Integrator::getBackwardSensitivities | ( | DVector & | Dx_x0, |
DVector & | Dx_p, | ||
DVector & | Dx_u, | ||
DVector & | Dx_w, | ||
int | order | ||
) | const |
Returns the result for the backward sensitivities at the time tend.
Dx_x0 | backward sensitivities w.r.t. the initial states |
Dx_p | backward sensitivities w.r.t. the parameters |
Dx_u | backward sensitivities w.r.t. the controls |
Dx_w | backward sensitivities w.r.t. the disturbance |
Definition at line 424 of file integrator.cpp.
double Integrator::getDifferentialEquationSampleTime | ( | ) | const [virtual] |
Returns the
Definition at line 478 of file integrator.cpp.
virtual int Integrator::getDim | ( | ) | const [protected, pure virtual] |
Returns the dimension of the Differential Equation
Implemented in IntegratorBDF, IntegratorLYAPUNOV, and IntegratorRK.
int Integrator::getDimX | ( | ) | const [protected, virtual] |
Returns the number of Dynamic Equations in the Differential Equation
Reimplemented in IntegratorBDF.
Definition at line 618 of file integrator.cpp.
returnValue Integrator::getForwardSensitivities | ( | DVector & | Dx, |
int | order | ||
) | const |
Returns the result for the forward sensitivities at the time tend.
Dx | the result for the forward sensitivities. |
order | the order. |
Definition at line 406 of file integrator.cpp.
returnValue Integrator::getForwardSensitivities | ( | VariablesGrid & | Dx, |
int | order | ||
) | const |
Returns the result for the forward sensitivities on the grid.
Dx | the result for the forward sensitivities. |
order | the order. |
Definition at line 414 of file integrator.cpp.
returnValue Integrator::getI | ( | VariablesGrid & | I | ) | const [inline] |
Returns the requested output on the specified grid.
The intermediate states constructed based on linear
interpolation.
I | the intermediates states on the grid. |
virtual int Integrator::getNumberOfRejectedSteps | ( | ) | const [pure virtual] |
Returns the number of rejected Steps.
Implemented in IntegratorBDF, IntegratorRK, and IntegratorLYAPUNOV.
virtual int Integrator::getNumberOfSteps | ( | ) | const [pure virtual] |
Returns the number of accepted Steps.
Implemented in IntegratorBDF, IntegratorRK, and IntegratorLYAPUNOV.
virtual returnValue Integrator::getProtectedBackwardSensitivities | ( | DVector & | Dx_x0, |
DVector & | Dx_p, | ||
DVector & | Dx_u, | ||
DVector & | Dx_w, | ||
int | order | ||
) | const [protected, pure virtual] |
Returns the result for the backward sensitivities at the time tend.
Dx_x0 | backward sensitivities w.r.t. the initial states |
Dx_p | backward sensitivities w.r.t. the parameters |
Dx_u | backward sensitivities w.r.t. the controls |
Dx_w | backward sensitivities w.r.t. the disturbance |
order | the order of the derivative |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
virtual returnValue Integrator::getProtectedForwardSensitivities | ( | DMatrix * | Dx, |
int | order | ||
) | const [protected, pure virtual] |
Returns the result for the forward sensitivities at the time tend.
Dx | the result for the forward sensitivi- ties |
order | the order |
Implemented in IntegratorLYAPUNOV, and IntegratorRK.
virtual returnValue Integrator::getProtectedX | ( | DVector * | xEnd | ) | const [protected, pure virtual] |
Returns the result for the state at the time tend.
xEnd | the result for the states at the time tend. |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
virtual double Integrator::getStepSize | ( | ) | const [pure virtual] |
Returns the current step size
Implemented in IntegratorBDF, IntegratorRK, and IntegratorLYAPUNOV.
returnValue Integrator::getX | ( | DVector & | xEnd | ) | const [inline] |
Returns the result for the differential states at the
time tend.
xEnd | the result for the states at the time tend. |
returnValue Integrator::getX | ( | VariablesGrid & | X | ) | const [inline] |
Returns the requested output on the specified grid. Note
that the output X will be evaluated based on polynomial
interpolation depending on the order of the integrator.
X | the differential states on the grid. |
returnValue Integrator::getXA | ( | DVector & | xaEnd | ) | const [inline] |
Returns the result for the algebraic states at the
time tend.
xaEnd | the result for the algebraic states at the time tend. |
returnValue Integrator::getXA | ( | VariablesGrid & | XA | ) | const [inline] |
Returns the requested output on the specified grid. Note
that the output X will be evaluated based on polynomial
interpolation depending on the order of the integrator.
XA | the algebraic states on the grid. |
virtual returnValue Integrator::init | ( | const DifferentialEquation & | rhs | ) | [pure virtual] |
The initialization routine which takes the right-hand side of
the differential equation to be integrated.
rhs | the right-hand side of the ODE/DAE. |
Implemented in IntegratorLYAPUNOV, IntegratorRK, IntegratorBDF, IntegratorDiscretizedODE, and IntegratorRK12.
returnValue Integrator::init | ( | const DifferentialEquation & | rhs, |
const Transition & | trs | ||
) |
The initialization routine which takes the right-hand side of
the differential equation to be integrated. In addition a
transition function can be set which is evaluated at the end
of the integration interval.
rhs | the right-hand side of the ODE/DAE. |
trs | the transition to be evaluated at the end. |
Reimplemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
Definition at line 185 of file integrator.cpp.
void Integrator::initializeOptions | ( | ) | [protected] |
Initializes the options. This routine should be called by the
integrators derived from this class in order to initialize
the following members based on the user options:
maxNumberOfSteps hmin hmax tune TOL las (cf. SETTINGS for more details)
Definition at line 587 of file integrator.cpp.
returnValue Integrator::integrate | ( | double | t0, |
double | tend, | ||
double * | x0, | ||
double * | xa = 0 , |
||
double * | p = 0 , |
||
double * | u = 0 , |
||
double * | w = 0 |
||
) |
Starts the integration of the right hand side at time t0.
If neither the maximum number of allowed iteration is
exceeded nor any other error occurs the functions stops the
integration at time tend.
t0 | the start time |
tend | the end time |
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 207 of file integrator.cpp.
returnValue Integrator::integrate | ( | const Grid & | t, |
double * | x0, | ||
double * | xa = 0 , |
||
double * | p = 0 , |
||
double * | u = 0 , |
||
double * | w = 0 |
||
) |
Starts the integration of the right hand side at time t0.
If neither the maximum number of allowed iteration is
exceeded nor any other error occurs the functions stops the
integration at time tend.
In addition, results at intermediate grid points can be
stored. Note that these grid points are for storage only and
have nothing to do the integrator steps.
t | the grid [t0,tend] |
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 220 of file integrator.cpp.
returnValue Integrator::integrate | ( | double | t0, |
double | tend, | ||
const DVector & | x0, | ||
const DVector & | xa = emptyVector , |
||
const DVector & | p = emptyVector , |
||
const DVector & | u = emptyVector , |
||
const DVector & | w = emptyVector |
||
) |
Starts the integration of the right hand side at time t0.
If neither the maximum number of allowed iteration is
exceeded nor any other error occurs the functions stops the
integration at time tend.
t0 | the start time |
tend | the end time |
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 241 of file integrator.cpp.
returnValue Integrator::integrate | ( | const Grid & | t, |
const DVector & | x0, | ||
const DVector & | xa = emptyVector , |
||
const DVector & | p = emptyVector , |
||
const DVector & | u = emptyVector , |
||
const DVector & | w = emptyVector |
||
) |
Starts the integration of the right hand side at time t0.
If neither the maximum number of allowed iteration is
exceeded nor any other error occurs the functions stops the
integration at time tend.
In addition, results at intermediate grid points can be
stored. Note that these grid points are for storage only and
have nothing to do the integrator steps.
t | the grid [t0,tend] |
x0 | the initial state |
xa | the initial algebraic state |
p | the parameters |
u | the controls |
w | the disturbance |
Definition at line 255 of file integrator.cpp.
< Integrates forward and/or backward depending on the specified seeds.
Definition at line 357 of file integrator.cpp.
BooleanType Integrator::isDifferentialEquationAffine | ( | ) | const [virtual] |
Returns if the differential equation of the integrator is affine.
Definition at line 471 of file integrator.cpp.
BooleanType Integrator::isDifferentialEquationDefined | ( | ) | const [virtual] |
Returns if the differential equation of the integrator is defined.
Definition at line 465 of file integrator.cpp.
returnValue Integrator::printRunTimeProfile | ( | ) | const [virtual] |
Prints the run-time profile. This routine
can be used after an integration run in
order to assess the performance.
Integrates forward and/or backward depending on the specified seeds.
Definition at line 624 of file integrator.cpp.
returnValue Integrator::setBackwardSeed | ( | const int & | order, |
const DVector & | seed | ||
) |
Define a backward seed
order | the order of the seed. |
seed | the backward seed |
Definition at line 338 of file integrator.cpp.
virtual returnValue Integrator::setDxInitialization | ( | double * | dx0 | ) | [pure virtual] |
Sets an initial guess for the differential state derivatives
(consistency condition)
dx0 | initial guess for the differential state derivatives |
Implemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
returnValue Integrator::setForwardSeed | ( | const int & | order, |
const DVector & | xSeed, | ||
const DVector & | pSeed = emptyVector , |
||
const DVector & | uSeed = emptyVector , |
||
const DVector & | wSeed = emptyVector |
||
) |
Define a forward seed matrix.
order | the order of the seed. |
xSeed | the seed w.r.t states |
pSeed | the seed w.r.t parameters |
uSeed | the seed w.r.t controls |
wSeed | the seed w.r.t disturbances |
Definition at line 308 of file integrator.cpp.
virtual returnValue Integrator::setProtectedBackwardSeed | ( | const DVector & | seed, |
const int & | order | ||
) | [protected, pure virtual] |
Define a backward seed
seed | the seed matrix |
order | the order of the seed. |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
virtual returnValue Integrator::setProtectedForwardSeed | ( | const DVector & | xSeed, |
const DVector & | pSeed, | ||
const DVector & | uSeed, | ||
const DVector & | wSeed, | ||
const int & | order | ||
) | [protected, pure virtual] |
Define a forward seed.
xSeed | the seed w.r.t the initial states |
pSeed | the seed w.r.t the parameters |
uSeed | the seed w.r.t the controls |
wSeed | the seed w.r.t the disturbances |
order | the order of the seed. |
Implemented in IntegratorLYAPUNOV, IntegratorRK, and IntegratorBDF.
returnValue Integrator::setTransition | ( | const Transition & | trs | ) |
Definition at line 198 of file integrator.cpp.
returnValue Integrator::setupLogging | ( | ) | [protected, virtual] |
Definition at line 599 of file integrator.cpp.
returnValue Integrator::setupOptions | ( | ) | [protected, virtual] |
Definition at line 566 of file integrator.cpp.
virtual returnValue Integrator::unfreeze | ( | ) | [pure virtual] |
Unfreezes the mesh: Gives the memory free that has previously
been allocated by "freeze". If you use the function
integrate after unfreezing the usual step size control will be
switched on.
Implemented in IntegratorRK, IntegratorLYAPUNOV, and IntegratorBDF.
friend class ShootingMethod [friend] |
Reimplemented in IntegratorDiscretizedODE, and IntegratorBDF.
Definition at line 65 of file integrator.hpp.
friend class SimulationByIntegration [friend] |
Reimplemented in IntegratorBDF.
Definition at line 64 of file integrator.hpp.
int* Integrator::alg_index [protected] |
the index list for the algebraic states
Definition at line 655 of file integrator.hpp.
int* Integrator::control_index [protected] |
the index list for the controls
Definition at line 656 of file integrator.hpp.
int Integrator::count [protected] |
a counter of the (accepted) steps
Definition at line 667 of file integrator.hpp.
int Integrator::count2 [protected] |
number of steps after integration
Definition at line 668 of file integrator.hpp.
int Integrator::count3 [protected] |
number of steps after integration
Definition at line 669 of file integrator.hpp.
int* Integrator::ddiff_index [protected] |
the index list for the differential state derivatives
Definition at line 654 of file integrator.hpp.
VariablesGrid Integrator::ddxStore [protected] |
Definition at line 713 of file integrator.hpp.
int* Integrator::diff_index [protected] |
the index list for the differential states
Definition at line 653 of file integrator.hpp.
DVector Integrator::diff_scale [protected] |
the scale of the differential states
Definition at line 670 of file integrator.hpp.
int* Integrator::disturbance_index [protected] |
the index list for the disturbances
Definition at line 660 of file integrator.hpp.
DVector Integrator::dP [protected] |
Definition at line 702 of file integrator.hpp.
DVector Integrator::dPb [protected] |
Definition at line 707 of file integrator.hpp.
DVector Integrator::dU [protected] |
Definition at line 703 of file integrator.hpp.
DVector Integrator::dUb [protected] |
Definition at line 708 of file integrator.hpp.
DVector Integrator::dW [protected] |
Definition at line 704 of file integrator.hpp.
DVector Integrator::dWb [protected] |
Definition at line 709 of file integrator.hpp.
DVector Integrator::dX [protected] |
Definition at line 701 of file integrator.hpp.
DVector Integrator::dXb [protected] |
Definition at line 706 of file integrator.hpp.
VariablesGrid Integrator::dxStore [protected] |
Definition at line 712 of file integrator.hpp.
RealClock Integrator::functionEvaluation [protected] |
Definition at line 695 of file integrator.hpp.
double* Integrator::h [protected] |
the initial step size = h[0]
Definition at line 640 of file integrator.hpp.
double Integrator::hini [protected] |
storage of the initial step size
Definition at line 641 of file integrator.hpp.
double Integrator::hmax [protected] |
the maximum step size
Definition at line 643 of file integrator.hpp.
double Integrator::hmin [protected] |
the minimum step size
Definition at line 642 of file integrator.hpp.
int* Integrator::int_control_index [protected] |
the index list for the integer controls
Definition at line 658 of file integrator.hpp.
int* Integrator::int_parameter_index [protected] |
the index list for the integer parameters
Definition at line 659 of file integrator.hpp.
VariablesGrid Integrator::iStore [protected] |
Definition at line 714 of file integrator.hpp.
int Integrator::las [protected] |
Definition at line 646 of file integrator.hpp.
short int Integrator::m [protected] |
the dimension of the right-hand side
Definition at line 620 of file integrator.hpp.
short int Integrator::ma [protected] |
the number of algebraic states
Definition at line 621 of file integrator.hpp.
int Integrator::maxNumberOfSteps [protected] |
the maximum number of integrator steps.
Definition at line 666 of file integrator.hpp.
short int Integrator::md [protected] |
number of differential states
Definition at line 629 of file integrator.hpp.
short int Integrator::mdx [protected] |
the dimension of differential state derivatives
Definition at line 622 of file integrator.hpp.
short int Integrator::mn [protected] |
the number of intermediate states in the rhs
Definition at line 623 of file integrator.hpp.
short int Integrator::mp [protected] |
the number of parameters
Definition at line 626 of file integrator.hpp.
short int Integrator::mpi [protected] |
the number of integer parameters
Definition at line 627 of file integrator.hpp.
short int Integrator::mu [protected] |
the number of controls
Definition at line 624 of file integrator.hpp.
short int Integrator::mui [protected] |
the number of integer controls
Definition at line 625 of file integrator.hpp.
short int Integrator::mw [protected] |
the number of disturbances
Definition at line 628 of file integrator.hpp.
int Integrator::nBDirs [protected] |
The number of backward directions
Definition at line 681 of file integrator.hpp.
int Integrator::nBDirs2 [protected] |
The number of second order backward directions
Definition at line 683 of file integrator.hpp.
int Integrator::nFcnEvaluations [protected] |
Definition at line 696 of file integrator.hpp.
int Integrator::nFDirs [protected] |
The number of forward directions
Definition at line 680 of file integrator.hpp.
int Integrator::nFDirs2 [protected] |
The number of second order forward directions
Definition at line 682 of file integrator.hpp.
int* Integrator::parameter_index [protected] |
the index list for the parameters
Definition at line 657 of file integrator.hpp.
int Integrator::PrintLevel [protected] |
The PrintLevel (default: LOW)
Definition at line 675 of file integrator.hpp.
DifferentialEquation* Integrator::rhs [protected] |
the right-hand side to be integrated
Definition at line 619 of file integrator.hpp.
StateOfAggregation Integrator::soa [protected] |
the state of aggregation
Definition at line 688 of file integrator.hpp.
int Integrator::time_index [protected] |
the time index
Definition at line 661 of file integrator.hpp.
Grid Integrator::timeInterval [protected] |
the type of linear algebra solver to be used the time interval
Definition at line 648 of file integrator.hpp.
double Integrator::TOL [protected] |
the integration tolerance
Definition at line 645 of file integrator.hpp.
RealClock Integrator::totalTime [protected] |
Definition at line 694 of file integrator.hpp.
Transition* Integrator::transition [protected] |
the transition to be evaluated at switches
Definition at line 634 of file integrator.hpp.
double Integrator::tune [protected] |
tuning parameter for the step size control.
Definition at line 644 of file integrator.hpp.
DVector Integrator::xE [protected] |
Definition at line 699 of file integrator.hpp.
VariablesGrid Integrator::xStore [protected] |
Definition at line 711 of file integrator.hpp.