Go to the documentation of this file.00001 #ifndef RK4OneStepTempl_H
00002 #define RK4OneStepTempl_H
00003
00004 #include "FWCore/Utilities/interface/Visibility.h"
00005 #include "RKSmallVector.h"
00006 #include "RKDerivative.h"
00007
00008 template <typename T, int N>
00009 class dso_internal RK4OneStepTempl {
00010 public:
00011
00012 typedef T Scalar;
00013 typedef RKSmallVector<T,N> Vector;
00014
00015
00016 Vector operator()( Scalar startPar, const Vector& startState,
00017 const RKDerivative<T,N>& deriv, Scalar step) const {
00018
00019
00020
00021 Vector k1 = step * deriv( startPar, startState);
00022 Vector k2 = step * deriv( startPar+step/2, startState+k1/2);
00023 Vector k3 = step * deriv( startPar+step/2, startState+k2/2);
00024 Vector k4 = step * deriv( startPar+step, startState+k3);
00025
00026 Vector result = startState + k1/6 + k2/3 + k3/3 + k4/6;
00027
00028
00029
00030 return result;
00031 }
00032 };
00033
00034 #endif