CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
AdaptiveRKStepper.hh
Go to the documentation of this file.
1#ifndef _AdaptiveRKStepper_h_
2#define _AdaptiveRKStepper_h_
3#include "CLHEP/GenericFunctions/RKIntegrator.hh"
4//
5// This is the default RKStepper routine, used within the RKIntegrator
6// when no other stepper is provided.
7//
8namespace Genfun {
9
11
12 public:
13
14 class EEStepper;
15
16 // Constructor. A default stepper is created if none
17 // is specified--it is an Embedded Runge Kutta stepper
18 // using a Cash-Karp extended Butcher Tableau, which
19 // is fourth-order.
20 AdaptiveRKStepper(const EEStepper *eeStepper=NULL);
21
22 // Copy constructor:
24
25 // Destructor:
26 virtual ~AdaptiveRKStepper();
27
28 // Takes *multiple* steps if needed up to or exceeding the
29 // specified time. This called from the RKFunction and not
30 // by users. If a time limit is specified, only one step
31 // is taken--this mode is used to interpolate between cached
32 // meshpoints.
33
34 // Input: data contains diffEqn information and cache:
35 // sData a summary of starting point information
36 // timeLimit (if nonzero) time limit for step
37 // Output dData a summary of into at the ending point.
38 //
39
40 virtual void step (const RKIntegrator::RKData * data,
41 const RKIntegrator::RKData::Data & sdata,
43 double timeLimit) const ;
44 // Clone
45 virtual AdaptiveRKStepper *clone() const;
46
47 // Accessors and modifiers to algorithmic parameters. Roughly
48 // speaking these are ordered according to importance: the user
49 // will often wish to modify the tolerance and the starting
50 // stepsize, but rarely should need to touch any of the others.
51
52 // The tolerance:
53 double & tolerance();
54 const double & tolerance() const;
55
56 // The starting stepsize:
57 double & startingStepsize();
58 const double & startingStepsize() const;
59
60 // The safety factor. Step size increases are moderated by this
61 // factor:
62 double & safetyFactor();
63 const double & safetyFactor() const;
64
65 // The minimum amount by which a step size is decreased:
66 double & rmin();
67 const double & rmin() const;
68
69 // The maximum amount by which a step size is increased:
70 double & rmax();
71 const double & rmax() const;
72
73
74 private:
75
76 // It is illegal to assign an AdaptiveRKStepper:
77 AdaptiveRKStepper & operator=(const AdaptiveRKStepper & right);
78
79 const EEStepper *eeStepper;
80 double T;
81 double sStepsize;
82 double S;
83 double Rmin;
84 double Rmax;
85 mutable double stepsize;
86 };
87
88
89 //
90 // An abstract base class for steppers that return an error
91 // estimate at each step:
92 //
94 public:
95
96 virtual ~EEStepper();
97 virtual void step (const RKIntegrator::RKData * data,
98 const RKIntegrator::RKData::Data & sdata,
100 std::vector<double> & errors) const = 0;
101 virtual EEStepper *clone() const=0;
102 virtual unsigned int order() const=0;
103 };
104}
105
106#endif
virtual EEStepper * clone() const =0
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 * clone() const
Definition: Abs.hh:14