12#include <include/qlibs_types.hpp>
52 real_t x[ 3 ] = { 0.0_re, 0.0_re, 0.0_re };
53 void inline update(
const real_t &s )
70 const real_t sn_1 = 0.0_re,
71 const real_t sn_2 = 0.0_re )
noexcept
73 init( x0, sn_1, sn_2 );
83 const real_t sn_1 = 0.0_re,
84 const real_t sn_2 = 0.0_re )
noexcept;
96 const bool bUpdate =
true ) noexcept;
108 const
bool bUpdate = true ) noexcept;
168 return x[ 0 ]*rValue;
172 return x[ 0 ]/rValue;
176 return x[ 0 ] + rValue;
180 return x[ 0 ] - rValue;
183 const nState& s )
noexcept;
185 const nState& s )
noexcept;
187 const nState& s )
noexcept;
189 const nState& s )
noexcept;
195 const nState& s )
noexcept
197 return rValue*s.x[ 0 ];
200 const nState& s )
noexcept
202 return rValue/s.x[ 0 ];
205 const nState& s )
noexcept
207 return rValue + s.x[ 0 ];
210 const nState& s )
noexcept
212 return rValue - s.x[ 0 ];
241 const real_t initialCondition = 0.0_re );
285 const real_t initialCondition = 0.0_re );
virtual ~derivative()
Definition numa.hpp:273
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:104
bool setSaturation(const real_t minV, const real_t maxV) noexcept
Sets the saturation limits for the integrator output.
Definition numa.cpp:74
virtual ~integrator()
Definition numa.hpp:228
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:68
A numerical state object.
Definition numa.hpp:50
virtual ~nState()
Definition numa.hpp:61
void setDerivationMethod(derivationMethod m) noexcept
Sets the numerical derivation method.
Definition numa.hpp:151
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:42
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:128
real_t operator()(void) const noexcept
Get the value of the state.
Definition numa.hpp:160
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:69
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