1#include "CLHEP/GenericFunctions/AdaptiveRKStepper.hh"
2#include "CLHEP/GenericFunctions/EmbeddedRKStepper.hh"
23 eeStepper(right.eeStepper->clone()),
25 sStepsize(right.sStepsize),
29 stepsize(right.sStepsize)
37 double timeLimit)
const {
44 const unsigned int p = eeStepper->
order();
45 const double deltaMax = T*std::pow(S/Rmax, (
int)(p+1));
46 const double TINY = 1.0E-30;
51 d.
time= timeLimit==0? s.
time+stepsize : timeLimit;
58 std::vector<double> errors;
59 eeStepper->
step(data, s, d, errors);
60 if (timeLimit!=0.0)
return;
63 for (
size_t e=0;e<errors.size();e++) errors[e] = fabs(errors[e]);
66 double delta = (*std::max_element(errors.begin(),errors.end()));
71 h = std::max(S*h*std::pow(T/(delta + TINY), 1.0/(p+1)),Rmin*h);
72 if (!(((
double) (s.
time+h) - (
double) s.
time) > 0) ) {
73 throw std::runtime_error(
"Warning, RK Integrator step underflow");
80 if (delta < deltaMax) {
81 hnext = S*h*std::pow(T/(delta + TINY),1.0/(p+1));
virtual void step(const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data &sdata, RKIntegrator::RKData::Data &ddata, std::vector< double > &errors) const =0
virtual unsigned int order() const =0
virtual void step(const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data &sdata, RKIntegrator::RKData::Data &ddata, double timeLimit) const
virtual ~AdaptiveRKStepper()
AdaptiveRKStepper(const EEStepper *eeStepper=NULL)
virtual AdaptiveRKStepper * clone() const
double & startingStepsize()