CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Genfun::SimpleRKStepper Class Reference

#include <SimpleRKStepper.hh>

+ Inheritance diagram for Genfun::SimpleRKStepper:

Public Member Functions

 SimpleRKStepper (const ButcherTableau &tableau, double stepsize)
 
virtual ~SimpleRKStepper ()
 
virtual void step (const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data &sdata, RKIntegrator::RKData::Data &ddata, double timeLimit) const
 
virtual SimpleRKStepperclone () const
 
- Public Member Functions inherited from Genfun::RKIntegrator::RKStepper
virtual ~RKStepper ()
 
virtual void step (const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data &sdata, RKIntegrator::RKData::Data &ddata, double timeLimit=0) const =0
 
virtual RKStepperclone () const =0
 

Detailed Description

Definition at line 17 of file SimpleRKStepper.hh.

Constructor & Destructor Documentation

◆ SimpleRKStepper()

Genfun::SimpleRKStepper::SimpleRKStepper ( const ButcherTableau tableau,
double  stepsize 
)

Definition at line 7 of file SimpleRKStepper.cc.

7 :
8 tableau(mtableau),
9 stepsize(xstepsize)
10 {
11 }

◆ ~SimpleRKStepper()

Genfun::SimpleRKStepper::~SimpleRKStepper ( )
virtual

Definition at line 44 of file SimpleRKStepper.cc.

44{}

Member Function Documentation

◆ clone()

SimpleRKStepper * Genfun::SimpleRKStepper::clone ( ) const
virtual

Implements Genfun::RKIntegrator::RKStepper.

Definition at line 46 of file SimpleRKStepper.cc.

46 {
47 return new SimpleRKStepper(*this);
48 }
SimpleRKStepper(const ButcherTableau &tableau, double stepsize)

◆ step()

void Genfun::SimpleRKStepper::step ( const RKIntegrator::RKData data,
const RKIntegrator::RKData::Data sdata,
RKIntegrator::RKData::Data ddata,
double  timeLimit 
) const
virtual

Implements Genfun::RKIntegrator::RKStepper.

Definition at line 13 of file SimpleRKStepper.cc.

16 {
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();
20 // Compute all of the k's..:
21 //
22 std::vector<std::vector<double> >k(tableau.nSteps());
23 for (unsigned int i=0;i<tableau.nSteps();i++) {
24 k[i].resize(nvar,0);
25 Argument arg(nvar);
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];
29 }
30 for (unsigned int v=0;v<nvar;v++) k[i][v]=(*data->_diffEqn[v])(arg);
31 }
32 //
33 // Final result.
34 //
35 for (unsigned int v=0;v<nvar;v++) d.firstDerivative[v] = 0;
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];
38 }
39 for (unsigned int v=0;v<nvar;v++) d.variable[v] =s.variable[v]+h*d.firstDerivative[v];
40 d.time = timeLimit==0 ? s.time + h : timeLimit;
41
42 }
unsigned int nSteps() const
double & A(unsigned int i, unsigned int j)
double & b(unsigned int i)

The documentation for this class was generated from the following files: