1#include "CLHEP/GenericFunctions/SimpleRKStepper.hh"
16 double timeLimit )
const {
17 const double h = timeLimit==0 ? stepsize : timeLimit - s.
time;
18 if (h<=0)
throw std::runtime_error (
"SimpleRKStepper: negative stepsize");
19 const unsigned int nvar = (
unsigned int)s.
variable.size();
22 std::vector<std::vector<double> >k(tableau.
nSteps());
23 for (
unsigned int i=0;i<tableau.
nSteps();i++) {
26 for (
unsigned int v=0;v<nvar;v++) arg[v]=s.
variable[v];
27 for (
unsigned int j=0;j<i;j++) {
28 for (
unsigned int v=0;v<nvar;v++) arg[v] += h*tableau.
A(i,j)*k[j][v];
30 for (
unsigned int v=0;v<nvar;v++) k[i][v]=(*data->
_diffEqn[v])(arg);
36 for (
unsigned int i=0;i<tableau.
nSteps();i++) {
37 for (
unsigned int v=0;v<nvar;v++) d.
firstDerivative[v] += tableau.
b(i)*k[i][v];
40 d.
time = timeLimit==0 ? s.
time + h : timeLimit;
unsigned int nSteps() const
double & A(unsigned int i, unsigned int j)
double & b(unsigned int i)
std::vector< const AbsFunction * > _diffEqn
SimpleRKStepper(const ButcherTableau &tableau, double stepsize)
virtual void step(const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data &sdata, RKIntegrator::RKData::Data &ddata, double timeLimit) const
virtual ~SimpleRKStepper()
virtual SimpleRKStepper * clone() const
std::vector< double > firstDerivative
std::vector< double > variable