src/fdm/utils/fdm_RungeKutta4.h
/**
     * @brief Integrates given vector using Runge-Kutta 4th order integration algorithm.
     * @param step integration time step [s]
     * @param vect integrating vector
     */
@brief Integrates given vector using Runge-Kutta 4th order integration algorithm.
@param step integration time step [s]
@param vect integrating vector
@brief Integrates given vector using Runge - Kutta 4th order integration algorithm . @param step integration time step [ s ] @param vect integrating vector
void integrate( double step, VectorN *vect )
    {
        _xt = (*vect);
        _k1.resize( vect->getSize() );
        _k2.resize( vect->getSize() );
        _k3.resize( vect->getSize() );
        _k4.resize( vect->getSize() );
        _k1.zeroize();
        _k2.zeroize();
        _k3.zeroize();
        _k4.zeroize();
        this->fun( _xt, &_k1 );
        _xt = (*vect) + _k1 * ( step / 2.0 );
        this->fun( _xt, &_k2 );
        _xt = (*vect) + _k2 * ( step / 2.0 );
        this->fun( _xt, &_k3 );
        _xt = (*vect) + _k3 * step;
        this->fun( _xt, &_k4 );
        (*vect) = (*vect) + ( _k1 + _k2 * 2.0 + _k3 * 2.0 + _k4 ) * ( step / 6.0 );
    }
void integrate ( double step , VectorN * vect ) { _xt = ( * vect ) ; _k1 . resize ( vect -> getSize ( ) ) ; _k2 . resize ( vect -> getSize ( ) ) ; _k3 . resize ( vect -> getSize ( ) ) ; _k4 . resize ( vect -> getSize ( ) ) ; _k1 . zeroize ( ) ; _k2 . zeroize ( ) ; _k3 . zeroize ( ) ; _k4 . zeroize ( ) ; this -> fun ( _xt , & _k1 ) ; _xt = ( * vect ) + _k1 * ( step / 2.0 ) ; this -> fun ( _xt , & _k2 ) ; _xt = ( * vect ) + _k2 * ( step / 2.0 ) ; this -> fun ( _xt , & _k3 ) ; _xt = ( * vect ) + _k3 * step ; this -> fun ( _xt , & _k4 ) ; ( * vect ) = ( * vect ) + ( _k1 + _k2 * 2.0 + _k3 * 2.0 + _k4 ) * ( step / 6.0 ) ; }
@brief Integrates given vector using Runge-Kutta 4th order integration algorithm.
@brief Integrates given vector using Runge - Kutta 4th order integration algorithm .
// k1 - derivatives calculation // k2 - derivatives calculation // k3 - derivatives calculation // k4 - derivatives calculation // integration