IntegratorCore< FP, Integrands > Class Template Reference

CPP API: mio::IntegratorCore< FP, Integrands > Class Template Reference
mio::IntegratorCore< FP, Integrands > Class Template Referenceabstract

Interface class defining the integration step used in a SystemIntegrator. More...

#include <integrator.h>

Inheritance diagram for mio::IntegratorCore< FP, Integrands >:

Public Member Functions

virtual std::unique_ptr< IntegratorCore< FP, Integrands... > > clone () const =0
 
 IntegratorCore (const FP &dt_min, const FP &dt_max)
 Initialize an IntegratorCore. More...
 
virtual bool step (const Integrands &... fs, Eigen::Ref< const Eigen::VectorX< FP >> yt, FP &t, FP &dt, Eigen::Ref< Eigen::VectorX< FP >> ytp1) const =0
 Make a single integration step. More...
 
virtual ~IntegratorCore ()
 
FP & get_dt_min ()
 Access lower bound to the step size dt. More...
 
const FP & get_dt_min () const
 Access lower bound to the step size dt. More...
 
FP & get_dt_max ()
 Access upper bound to the step size dt. More...
 
const FP & get_dt_max () const
 Access upper bound to the step size dt. More...
 

Private Attributes

FP m_dt_max
 
FP m_dt_min
 

Detailed Description

template<typename FP, class... Integrands>
class mio::IntegratorCore< FP, Integrands >

Interface class defining the integration step used in a SystemIntegrator.

Template Parameters
FPA floating point type, e.g. double.
IntegrandsOne or more function types used for defining the right hand side of a system of equations.

Constructor & Destructor Documentation

◆ IntegratorCore()

template<typename FP , class... Integrands>
mio::IntegratorCore< FP, Integrands >::IntegratorCore ( const FP &  dt_min,
const FP &  dt_max 
)
inline

Initialize an IntegratorCore.

Step size bounds are needed for adaptive integrators, see the step method for more detail. Fixed size steppers ignore those bounds and may use the default constructor for FP.

Parameters
dt_minLower bound to the step size dt, as used in the step method.
dt_maxUpper bound to the step size dt, as used in the step method.

◆ ~IntegratorCore()

template<typename FP , class... Integrands>
virtual mio::IntegratorCore< FP, Integrands >::~IntegratorCore ( )
inlinevirtual

Member Function Documentation

◆ clone()

template<typename FP , class... Integrands>
virtual std::unique_ptr<IntegratorCore<FP, Integrands...> > mio::IntegratorCore< FP, Integrands >::clone ( ) const
pure virtual

◆ get_dt_max() [1/2]

template<typename FP , class... Integrands>
FP& mio::IntegratorCore< FP, Integrands >::get_dt_max ( )
inline

Access upper bound to the step size dt.

These values will only be used by adaptive steppers. Fixed size steppers ignore them.

Returns
A reference to the maximum possible value of dt.

◆ get_dt_max() [2/2]

template<typename FP , class... Integrands>
const FP& mio::IntegratorCore< FP, Integrands >::get_dt_max ( ) const
inline

Access upper bound to the step size dt.

These values will only be used by adaptive steppers. Fixed size steppers ignore them.

Returns
A reference to the maximum possible value of dt.

◆ get_dt_min() [1/2]

template<typename FP , class... Integrands>
FP& mio::IntegratorCore< FP, Integrands >::get_dt_min ( )
inline

Access lower bound to the step size dt.

These values will only be used by adaptive steppers. Fixed size steppers ignore them.

Returns
A reference to the minimum possible value of dt.

◆ get_dt_min() [2/2]

template<typename FP , class... Integrands>
const FP& mio::IntegratorCore< FP, Integrands >::get_dt_min ( ) const
inline

Access lower bound to the step size dt.

These values will only be used by adaptive steppers. Fixed size steppers ignore them.

Returns
A reference to the minimum possible value of dt.

◆ step()

template<typename FP , class... Integrands>
virtual bool mio::IntegratorCore< FP, Integrands >::step ( const Integrands &...  fs,
Eigen::Ref< const Eigen::VectorX< FP >>  yt,
FP &  t,
FP &  dt,
Eigen::Ref< Eigen::VectorX< FP >>  ytp1 
) const
pure virtual

Make a single integration step.

The behaviour of this method changes when the integration scheme has adaptive step sizing. These changes are noted in the parentheses (...) below. Adaptive integrators use the bounds dt_min and dt_max for dt, accessible through the IntegratorCore member functions get_dt_min() and get_dt_max(), respectively. Fixed step integrators ignore these values. The adaptive step sizing is considered to be successful, if a step of at least size dt_min sufficed tolerances. Tolerances are defined in each implementation, usually using a criterion with absolute and relative tolerances. Even if the step sizing failed, the integrator will make a step of at least size dt_min.

Parameters
[in]fsOne or more function(s) defining the right hand side of the IVP. May be called multiple times with different arguments.
[in]ytThe known value of y at time t.
[in,out]tThe current time. It will be increased by dt. (If adaptive, the increment is instead within [dt_min, dt].)
[in,out]dtThe current step size h=dt. Will not be changed. (If adaptive, the given dt is used as the maximum step size, and must be within [dt_min, dt_max]. During integration, dt is adjusted in [dt_min, dt_max] to have an optimal size for the next step.)
[out]ytp1Set to the approximated value of y at time t + dt. (If adaptive, this time may be smaller, but it is at least t + dt_min, at most t + dt_max. Note that the increment on t may be different from the returned value of dt.)
Returns
Always true for nonadaptive methods. (If adaptive, returns whether the adaptive step sizing was successful.)

Member Data Documentation

◆ m_dt_max

template<typename FP , class... Integrands>
FP mio::IntegratorCore< FP, Integrands >::m_dt_max
private

◆ m_dt_min

template<typename FP , class... Integrands>
FP mio::IntegratorCore< FP, Integrands >::m_dt_min
private