CMS 3D CMS Logo

Public Types | Public Member Functions

RK4OneStepTempl< T, N > Class Template Reference

#include <RK4OneStepTempl.h>

List of all members.

Public Types

typedef T Scalar
typedef RKSmallVector< T, N > Vector

Public Member Functions

Vector operator() (Scalar startPar, const Vector &startState, const RKDerivative< T, N > &deriv, Scalar step) const

Detailed Description

template<typename T, int N>
class RK4OneStepTempl< T, N >

Definition at line 9 of file RK4OneStepTempl.h.


Member Typedef Documentation

template<typename T, int N>
typedef T RK4OneStepTempl< T, N >::Scalar

Definition at line 12 of file RK4OneStepTempl.h.

template<typename T, int N>
typedef RKSmallVector<T,N> RK4OneStepTempl< T, N >::Vector

Definition at line 13 of file RK4OneStepTempl.h.


Member Function Documentation

template<typename T, int N>
Vector RK4OneStepTempl< T, N >::operator() ( Scalar  startPar,
const Vector startState,
const RKDerivative< T, N > &  deriv,
Scalar  step 
) const [inline]

Definition at line 16 of file RK4OneStepTempl.h.

References query::result.

                                                                          {

        // cout << "RK4OneStepTempl: starting from " << startPar << startState << endl;

        Vector k1 = step * deriv( startPar, startState);
        Vector k2 = step * deriv( startPar+step/2, startState+k1/2);
        Vector k3 = step * deriv( startPar+step/2, startState+k2/2);
        Vector k4 = step * deriv( startPar+step, startState+k3);

        Vector result = startState + k1/6 + k2/3 + k3/3 + k4/6;

        // cout << "RK4OneStepTempl: result for step " << step << " is " << result << endl;

        return result;
    }