CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RKOne4OrderStep.h
Go to the documentation of this file.
1 #ifndef RKOne4OrderStep_H
2 #define RKOne4OrderStep_H
3 
5 
6 #include <utility>
7 
8 template <typename T, int N>
10 public:
11 
12  typedef T Scalar;
14 
15  std::pair< Vector, T>
16  operator()( Scalar startPar, const Vector& startState,
17  const RKDerivative<T,N>& deriv,
18  const RKDistance<T,N>& dist, Scalar step) {
19  const Scalar huge = 1.e5; // ad hoc protection against infinities, must be done better!
20  const Scalar hugediff = 100.;
21 
22  RK4OneStepTempl<T,N> solver;
23  Vector one( solver(startPar, startState, deriv, step));
24  if (std::abs(one[0])>huge || std::abs(one(1)>huge)) return std::pair<Vector, Scalar>(one,hugediff);
25 
26  Vector firstHalf( solver(startPar, startState, deriv, step/2));
27  Vector secondHalf(solver(startPar+step/2, firstHalf, deriv, step/2));
28  Scalar diff = dist(one, secondHalf, startPar+step);
29  return std::pair<Vector, Scalar>(secondHalf,diff);
30  }
31 };
32 #endif
list step
Definition: launcher.py:15
#define abs(x)
Definition: mlp_lapack.h:159
RKSmallVector< T, N > Vector
Base class for derivative calculation.
Definition: RKDerivative.h:9
std::pair< Vector, T > operator()(Scalar startPar, const Vector &startState, const RKDerivative< T, N > &deriv, const RKDistance< T, N > &dist, Scalar step)
long double T