CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

CLHEP/GenericFunctions/AdaptiveRKStepper.hh
Go to the documentation of this file.
1 #ifndef _AdaptiveRKStepper_h_
2 #define _AdaptiveRKStepper_h_
4 //
5 // This is the default RKStepper routine, used within the RKIntegrator
6 // when no other stepper is provided.
7 //
8 namespace 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:
23  AdaptiveRKStepper(const AdaptiveRKStepper & right);
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
Genfun::AdaptiveRKStepper::rmax
double & rmax()
Definition: AdaptiveRKStepper.cc:135
Genfun::AdaptiveRKStepper::safetyFactor
double & safetyFactor()
Definition: AdaptiveRKStepper.cc:120
RKIntegrator.hh
Genfun::AdaptiveRKStepper::EEStepper::order
virtual unsigned int order() const =0
Genfun::AdaptiveRKStepper::startingStepsize
double & startingStepsize()
Definition: AdaptiveRKStepper.cc:113
Genfun::AdaptiveRKStepper::clone
virtual AdaptiveRKStepper * clone() const
Definition: AdaptiveRKStepper.cc:98
Genfun::AdaptiveRKStepper::EEStepper::step
virtual void step(const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data &sdata, RKIntegrator::RKData::Data &ddata, std::vector< double > &errors) const =0
Genfun::RKIntegrator::RKStepper
Definition: CLHEP/GenericFunctions/RKIntegrator.hh:172
Genfun::AdaptiveRKStepper::tolerance
double & tolerance()
Definition: AdaptiveRKStepper.cc:105
Genfun::AdaptiveRKStepper::EEStepper::clone
virtual EEStepper * clone() const =0
Genfun::AdaptiveRKStepper::EEStepper::~EEStepper
virtual ~EEStepper()
Definition: AdaptiveRKStepper.cc:102
Genfun::AdaptiveRKStepper::step
virtual void step(const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data &sdata, RKIntegrator::RKData::Data &ddata, double timeLimit) const
Definition: AdaptiveRKStepper.cc:31
Genfun::RKIntegrator::RKData::Data
Definition: CLHEP/GenericFunctions/RKIntegrator.hh:108
Genfun::RKIntegrator::RKData
Definition: CLHEP/GenericFunctions/RKIntegrator.hh:102
Genfun::AdaptiveRKStepper::AdaptiveRKStepper
AdaptiveRKStepper(const EEStepper *eeStepper=NULL)
Definition: AdaptiveRKStepper.cc:7
Genfun::AdaptiveRKStepper::~AdaptiveRKStepper
virtual ~AdaptiveRKStepper()
Definition: AdaptiveRKStepper.cc:94
Genfun::AdaptiveRKStepper::rmin
double & rmin()
Definition: AdaptiveRKStepper.cc:128
Genfun::AdaptiveRKStepper
Definition: CLHEP/GenericFunctions/AdaptiveRKStepper.hh:10
Genfun::AdaptiveRKStepper::EEStepper
Definition: CLHEP/GenericFunctions/AdaptiveRKStepper.hh:93
Genfun
Definition: CLHEP/GenericFunctions/Abs.hh:14