CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
CLHEP
GenericFunctions
CLHEP/GenericFunctions/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
//
8
namespace
Genfun {
9
10
class
AdaptiveRKStepper
:
public
RKIntegrator::RKStepper
{
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,
42
RKIntegrator::RKData::Data
& ddata,
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
//
93
class
AdaptiveRKStepper::EEStepper
{
94
public
:
95
96
virtual
~EEStepper
();
97
virtual
void
step
(
const
RKIntegrator::RKData
* data,
98
const
RKIntegrator::RKData::Data
& sdata,
99
RKIntegrator::RKData::Data
& ddata,
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
Generated on Mon May 6 2013 04:04:10 for CLHEP by
1.8.1.2