12#include <include/qlibs_types.hpp>
52 real_t x[ 3 ] = { 0.0_re, 0.0_re, 0.0_re };
55 void inline update(
const real_t &s )
72 const real_t sn_1 = 0.0_re,
73 const real_t sn_2 = 0.0_re )
noexcept
75 init( x0, sn_1, sn_2 );
85 const real_t sn_1 = 0.0_re,
86 const real_t sn_2 = 0.0_re )
noexcept;
98 const bool bUpdate =
true ) noexcept;
110 const
bool bUpdate = true ) noexcept;
167 const real_t maxV )
noexcept;
181 return x[ 0 ]*rValue;
185 return x[ 0 ]/rValue;
189 return x[ 0 ] + rValue;
193 return x[ 0 ] - rValue;
196 const nState& s )
noexcept;
198 const nState& s )
noexcept;
200 const nState& s )
noexcept;
202 const nState& s )
noexcept;
208 const nState& s )
noexcept
210 return rValue*s.x[ 0 ];
213 const nState& s )
noexcept
215 return rValue/s.x[ 0 ];
218 const nState& s )
noexcept
220 return rValue + s.x[ 0 ];
223 const nState& s )
noexcept
225 return rValue - s.x[ 0 ];
252 const real_t initialCondition = 0.0_re );
293 const real_t initialCondition = 0.0_re );
derivative(const real_t timeStep, const real_t initialCondition=0.0_re)
Constructs a derivative block with a given timeStep and optional initial condition.
Definition numa.cpp:119
virtual ~derivative()=default
real_t operator()() const
Retrieve the current value of the integration.
Definition numa.cpp:114
integrator(const real_t timeStep, const real_t initialCondition=0.0_re)
Constructs an integrator block with a given timeStep time and optional initial condition.
Definition numa.cpp:103
virtual ~integrator()=default
A numerical state object.
Definition numa.hpp:50
bool setSaturation(const real_t minV, const real_t maxV) noexcept
Sets the saturation limits for the integrator output.
Definition numa.cpp:90
void setDerivationMethod(derivationMethod m) noexcept
Sets the numerical derivation method.
Definition numa.hpp:153
virtual ~nState()=default
real_t derive(const real_t s, const real_t dt, const bool bUpdate=true) noexcept
Perform a numerical derivation step by using the specified derivation method.
Definition numa.cpp:53
real_t integrate(const real_t s, const real_t dt, const bool bUpdate=true) noexcept
Perform a numerical integration step by using the specified integration method.
Definition numa.cpp:15
void init(const real_t x0=0.0_re, const real_t sn_1=0.0_re, const real_t sn_2=0.0_re) noexcept
Initialize the state object.
Definition numa.cpp:6
void setIntegrationMethod(integrationMethod m) noexcept
Sets the numerical integration method.
Definition numa.hpp:130
real_t operator()(void) const noexcept
Get the value of the state.
Definition numa.hpp:173
nState(const real_t x0=0.0_re, const real_t sn_1=0.0_re, const real_t sn_2=0.0_re) noexcept
Constructor for the state object.
Definition numa.hpp:71
derivationMethod
An enum with all the available derivation methods.
Definition numa.hpp:38
integrationMethod
An enum with all the available integration methods.
Definition numa.hpp:28
@ DERIVATION_FORWARD
Definition numa.hpp:41
@ DERIVATION_BACKWARD
Definition numa.hpp:40
@ DERIVATION_2POINTS
Definition numa.hpp:39
@ INTEGRATION_QUADRATIC
Definition numa.hpp:32
@ INTEGRATION_SIMPSON
Definition numa.hpp:31
@ INTEGRATION_TRAPEZOIDAL
Definition numa.hpp:30
@ INTEGRATION_RECTANGULAR
Definition numa.hpp:29
The qLibs++ library namespace.
Definition mat.hpp:18
float real_t
A type to instantiate a real variable double-precision of 64-bits IEEE 754.
Definition qlibs_types.hpp:43