CMS 3D CMS Logo

Public Types | Public Member Functions

RKOne4OrderStep< T, N > Class Template Reference

#include <RKOne4OrderStep.h>

List of all members.

Public Types

typedef T Scalar
typedef RKSmallVector< T, N > Vector

Public Member Functions

std::pair< Vector, Toperator() (Scalar startPar, const Vector &startState, const RKDerivative< T, N > &deriv, const RKDistance< T, N > &dist, Scalar step)

Detailed Description

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

Definition at line 10 of file RKOne4OrderStep.h.


Member Typedef Documentation

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

Definition at line 14 of file RKOne4OrderStep.h.

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

Definition at line 15 of file RKOne4OrderStep.h.


Member Function Documentation

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

Definition at line 18 of file RKOne4OrderStep.h.

References abs, and diffTreeTool::diff.

                                                        {
    const Scalar huge = 1.e5;  // ad hoc protection against infinities, must be done better!
    const Scalar hugediff = 100.;

    RK4OneStepTempl<T,N> solver;
    Vector one(       solver(startPar, startState, deriv, step));
    if (std::abs(one[0])>huge || std::abs(one(1)>huge)) return std::pair<Vector, Scalar>(one,hugediff);

    Vector firstHalf( solver(startPar, startState, deriv, step/2));
    Vector secondHalf(solver(startPar+step/2, firstHalf, deriv, step/2));
    Scalar diff = dist(one, secondHalf, startPar+step);
    return std::pair<Vector, Scalar>(secondHalf,diff);
  }
};