WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
warpos::RK4Integrator< N > Class Template Reference

#include <RK4Integrator.hpp>

Inheritance diagram for warpos::RK4Integrator< N >:

Public Member Functions

 RK4Integrator (Rates< N > &rate_calculator)
int16 step (floating_point start_time, floating_point end_time, const std::array< floating_point, N > &start_state, std::array< floating_point, N > &out_state) override
void configureForStep (floating_point start_time, floating_point end_time, const std::array< floating_point, N > &start_state)
 Function to configure a full integration step.
int16 calculateK1 (std::array< floating_point, N > &state_for_k2)
 Function to calculate k1.
int16 calculateK2 (const std::array< floating_point, N > &state_in_k2, std::array< floating_point, N > &state_for_k3)
 Function to calculate k2.
int16 calculateK3 (const std::array< floating_point, N > &state_in_k2, std::array< floating_point, N > &state_for_k4)
 Function to calculate k3.
int16 calculateK4 (const std::array< floating_point, N > &state_in_k4)
 Function to calculate k4.
void getValueEndStep (std::array< floating_point, N > &end_state)
 Calculation of final integrated step at the end of state.
Public Member Functions inherited from warpos::Integrator< N >
 Integrator (Rates< N > &rate_calculator)
 Constructor for the integrator.

Protected Attributes

floating_point _full_step_size = 1.0
 Step size for integrator.
floating_point _half_step_size = 0.5
floating_point _step_average
floating_point _start_time
 Initial state tracking.
floating_point _end_time
std::array< floating_point, N > _start_state
std::array< floating_point, N > _k1
 RK4 step rate values k1, k2, k3, k4 and var to calc average rate.
std::array< floating_point, N > _k2
std::array< floating_point, N > _k3
std::array< floating_point, N > _k4
int16 _error = 0
 Error code.
int16 _saved_warning = 0
Protected Attributes inherited from warpos::Integrator< N >
Rates< N > & _rate_calculator
 Reference to dynamics object that calculates rates.

Constructor & Destructor Documentation

◆ RK4Integrator()

template<uint32 N>
warpos::RK4Integrator< N >::RK4Integrator ( Rates< N > & rate_calculator)

Member Function Documentation

◆ calculateK1()

template<uint32 N>
int16 warpos::RK4Integrator< N >::calculateK1 ( std::array< floating_point, N > & state_for_k2)

Function to calculate k1.

Parameters
state_for_k2The integrated state to be used in the calculation of k2
Returns
Error code describing success/failure

◆ calculateK2()

template<uint32 N>
int16 warpos::RK4Integrator< N >::calculateK2 ( const std::array< floating_point, N > & state_in_k2,
std::array< floating_point, N > & state_for_k3 )

Function to calculate k2.

Parameters
state_in_k2The state input to calculate k2
state_for_k3The integrated state to be used in the calculation of k3
Returns
Error code describing success/failure

◆ calculateK3()

template<uint32 N>
int16 warpos::RK4Integrator< N >::calculateK3 ( const std::array< floating_point, N > & state_in_k2,
std::array< floating_point, N > & state_for_k4 )

Function to calculate k3.

Parameters
state_in_k3The state input to calculate k3
state_for_k4The integrated state to be used in the calculation of k4
Returns
Error code describing success/failure

◆ calculateK4()

template<uint32 N>
int16 warpos::RK4Integrator< N >::calculateK4 ( const std::array< floating_point, N > & state_in_k4)

Function to calculate k4.

Parameters
state_in_k4The state input to calculate k4
Returns
Error code describing success/failure

◆ configureForStep()

template<uint32 N>
void warpos::RK4Integrator< N >::configureForStep ( floating_point start_time,
floating_point end_time,
const std::array< floating_point, N > & start_state )

Function to configure a full integration step.


Functions for manual RK4 control – calling these individually allows a downstream user to manually control RK4 steps. Each is executed in order

for a full step

Parameters
start_timeStart time for the full integration step
end_timeEnd time for the full integration step
start_stateState at start of integration

◆ getValueEndStep()

template<uint32 N>
void warpos::RK4Integrator< N >::getValueEndStep ( std::array< floating_point, N > & end_state)

Calculation of final integrated step at the end of state.

Parameters
end_stateState at the end of step

◆ step()

template<uint32 N>
int16 warpos::RK4Integrator< N >::step ( floating_point start_time,
floating_point end_time,
const std::array< floating_point, N > & start_state,
std::array< floating_point, N > & out_state )
overridevirtual

Function to take a full integrator step forward from time start to time end

Parameters
start_timeStart time for integration
end_timeEnd time for integration
start_stateState at start of integration
out_stateOutput state via implicit – result of integration

Reimplemented from warpos::Integrator< N >.

Member Data Documentation

◆ _end_time

template<uint32 N>
floating_point warpos::RK4Integrator< N >::_end_time
protected

◆ _error

template<uint32 N>
int16 warpos::RK4Integrator< N >::_error = 0
protected

Error code.

◆ _full_step_size

template<uint32 N>
floating_point warpos::RK4Integrator< N >::_full_step_size = 1.0
protected

Step size for integrator.

◆ _half_step_size

template<uint32 N>
floating_point warpos::RK4Integrator< N >::_half_step_size = 0.5
protected

◆ _k1

template<uint32 N>
std::array<floating_point, N> warpos::RK4Integrator< N >::_k1
protected

RK4 step rate values k1, k2, k3, k4 and var to calc average rate.

◆ _k2

template<uint32 N>
std::array<floating_point, N> warpos::RK4Integrator< N >::_k2
protected

◆ _k3

template<uint32 N>
std::array<floating_point, N> warpos::RK4Integrator< N >::_k3
protected

◆ _k4

template<uint32 N>
std::array<floating_point, N> warpos::RK4Integrator< N >::_k4
protected

◆ _saved_warning

template<uint32 N>
int16 warpos::RK4Integrator< N >::_saved_warning = 0
protected

◆ _start_state

template<uint32 N>
std::array<floating_point, N> warpos::RK4Integrator< N >::_start_state
protected

◆ _start_time

template<uint32 N>
floating_point warpos::RK4Integrator< N >::_start_time
protected

Initial state tracking.

◆ _step_average

template<uint32 N>
floating_point warpos::RK4Integrator< N >::_step_average
protected

The documentation for this class was generated from the following file:
  • /Users/mickey/Documents/Projects/warptwin/warpos/src/gncutils/integrator/RK4Integrator.hpp