33 #ifndef STATE_SIM_TEMPLATE_H 34 #define STATE_SIM_TEMPLATE_H 38 #include <boost/numeric/odeint.hpp> 47 template <std::
size_t StateSize, std::
size_t StateNmSize>
49 template <std::
size_t StateSize, std::
size_t StateNmSize>
51 template <std::
size_t StateSize, std::
size_t StateNmSize>
53 template <std::
size_t StateSize, std::
size_t StateNmSize>
55 template <std::
size_t StateSize, std::
size_t StateNmSize>
57 template <std::
size_t StateSize, std::
size_t StateNmSize>
98 for (std::size_t i = 0; i < sNmS; i++)
113 for (std::size_t i = 0; i < sNmS; i++)
119 rk = std::shared_ptr<boost::numeric::odeint::runge_kutta4<std::array<double, StateNmSize>>>(
new boost::numeric::odeint::runge_kutta4<std::array<double, StateNmSize>>);
126 discrFunc_ = RungeKutta::getDiscrFunc<StateNmSize>(_discrType);
134 for (std::size_t i = 0; i < sNmS; i++)
169 double&
value(
const std::size_t& _i)
override 171 if (_i < StateNmSize)
182 const double&
value(
const std::size_t& _i)
const override 184 if (_i < StateNmSize)
205 [
this](
const std::array<double, StateNmSize>& _x, std::array<double, StateNmSize>& _dxdt,
const double _t)
218 void sys1(
const std::array<double, StateNmSize>& _x, std::array<double, StateNmSize>& _dxdt,
const double _t)
228 std::shared_ptr<boost::numeric::odeint::runge_kutta4<std::array<double, StateNmSize>>>
rk;
251 #endif // STATE_SIM_TEMPLATE_H virtual StateSPtr cloneState() const override
Clone-to-base-class-ptr function.
StateArray< StateSize-StateNmSize > stateCf_
State array storing the closed-form-computed value.
StateSimTemplate()=default
std::shared_ptr< State > StateSPtr
previous evaluation arc <= this evaluation arc
this evaluation arc is at the arc parametrization begin
StateArray< StateNmSize > stateNm_
State array storing the numerical-computed value.
std::shared_ptr< StateSimTemplate< StateSize, StateNmSize >> StateSimTemplateSPtr
void advanceODEInt(double _arc)
std::unique_ptr< StateSimTemplate< StateSize, StateNmSize >> StateSimTemplateUPtr
const double & value(const std::size_t &_i) const override
Const access state variable based on index _i.
void advance(double _arc) override
Performs one simulation step to parametrized arc length _arc.
std::shared_ptr< StateSimTemplate< StateSize, StateNmSize > const > StateSimTemplateConstSPtr
virtual void setStateCfNmStep(const double &_arc, const ParamFuncs::EvalArcGuarantee &_evalArcGuarantee=ParamFuncs::EvalArcGuarantee::AFTER_LAST)
StateArray< StateSize > state0_
State array storing the initial value.
virtual size_t valueSize() const override
Size of the state variables.
DiscretizationType
Several discretization modes.
Templated partial implementation of StateSim.
std::unique_ptr< StateSimTemplate< StateSize, StateNmSize > const > StateSimTemplateConstUPtr
virtual double & value(const std::size_t &_i) override
Access state variable based on index _i.
Generic tree-like recursive structure that allows sub-structure access as well as ordered (array-like...
State & stateCf() override
Reference to the actual closed-form state.
void toState0() override
Resets entire state to state0. It also sets the control structure evaluation point at most at the new...
virtual State & stateNmDot()=0
Computes numerical continuous arc state transition (return) based on internal closed-form state (stat...
void sys1(const std::array< double, StateNmSize > &_x, std::array< double, StateNmSize > &_dxdt, const double _t)
void setState(StateSPtr &_otherState) override
Sets the state variables to the values of _otherState. It also sets the control structure evaluation ...
std::array< double, N > & valuesArray()
Reference to the state variables array.
void setDiscrType(const RungeKutta::DiscretizationType &_discrType) override
Set discretization type used in the simulation.
RungeKutta::DiscretizationFuncPtr discrFunc_
Pointer to the active discretization-method function.
size_t valueSize() const override
Size of the state variables.
virtual void setStateCf(const double &_arc, const ParamFuncs::EvalArcGuarantee &_evalArcGuarantee=ParamFuncs::EvalArcGuarantee::AFTER_LAST)=0
Sets closed-form state at arc _arc.
StateSimTemplate & operator=(const StateSimTemplate &_o)
Interface for a state simulator structure that performs numerical integration of not-closed-form stat...
State & state0() override
Reference to the initial state.
double & value(const std::size_t &_i) override
Access state variable based on index _i.
State & stateNm() override
Reference to the actual numerical-computed state.
StateArray< StateNmSize > stateNmDotCache_
State array caching the evaluation of the last call of the value transition function.
std::shared_ptr< boost::numeric::odeint::runge_kutta4< std::array< double, StateNmSize > > > rk
void(*)(StateSim &, const double &) DiscretizationFuncPtr
StateSimTemplate(const StateSimTemplate &_o)
virtual ~StateSimTemplate()=default