#include <G4ModifiedMidpoint.hh>
|
| G4ModifiedMidpoint (G4EquationOfMotion *equation, G4int nvar=6, G4int steps=2) |
|
| ~G4ModifiedMidpoint ()=default |
|
void | DoStep (const G4double yIn[], const G4double dydxIn[], G4double yOut[], G4double hstep) const |
|
void | DoStep (const G4double yIn[], const G4double dydxIn[], G4double yOut[], G4double hstep, G4double yMid[], G4double derivs[][G4FieldTrack::ncompSVEC]) const |
|
void | SetSteps (G4int steps) |
|
G4int | GetSteps () const |
|
void | SetEquationOfMotion (G4EquationOfMotion *equation) |
|
G4EquationOfMotion * | GetEquationOfMotion () |
|
G4int | GetNumberOfVariables () const |
|
Definition at line 41 of file G4ModifiedMidpoint.hh.
◆ G4ModifiedMidpoint()
Definition at line 36 of file G4ModifiedMidpoint.cc.
38 : fEquation(equation), fnvar(nvar), fsteps(steps)
39{
40 if (nvar <= 0)
41 {
42 G4Exception(
"G4ModifiedMidpoint::G4ModifiedMidpoint()",
44 "Invalid number of variables; must be greater than zero!");
45 }
46}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
◆ ~G4ModifiedMidpoint()
G4ModifiedMidpoint::~G4ModifiedMidpoint |
( |
| ) |
|
|
default |
◆ DoStep() [1/2]
Definition at line 48 of file G4ModifiedMidpoint.cc.
50{
54 setValue(yIn, Value1D::LabTime, y0, y1, yTemp, yOut);
55
57
60
61
62
63 for (
G4int i = 0; i < fnvar; ++i)
64 {
65 y1[i] = yIn[i] + h * dydyIn[i];
66 }
67
69
70 copy(y0, yIn);
71
72
73
74
75 for (
G4int i = 1; i < fsteps; ++i)
76 {
77 copy(yTemp, y1);
78 for (
G4int j = 0; j < fnvar; ++j)
79 {
80 y1[j] = y0[j] + h2 * dydx[j];
81 }
82 copy(y0, yTemp);
83
85 }
86
87
88
89
90 for (
G4int i = 0; i < fnvar; ++i)
91 {
92 yOut[i] = 0.5 * (y0[i] + y1[i] + h * dydx[i]);
93 }
94}
void RightHandSide(const G4double y[], G4double dydx[]) const
void setValue(const SourceArray &src, Value1D value, TargetArray &trg)
Referenced by G4BulirschStoer::try_step().
◆ DoStep() [2/2]
Definition at line 96 of file G4ModifiedMidpoint.cc.
99{
103 setValue(yIn, Value1D::LabTime, y0, y1, yTemp, yMid, yOut);
104
107
108
109 copy(y0, yIn);
110
111
112 for (
G4int i = 0; i < fnvar; ++i)
113 {
114 y1[i] = y0[i] + h * dydxIn[i];
115 }
116
117
118
119
120 if(fsteps == 2)
121 {
122 copy(yMid, y1);
123 }
124
126
127
128
129
130 for (
G4int i = 1; i < fsteps; ++i)
131 {
132 copy(yTemp, y1);
133 for (
G4int j = 0; j < fnvar; ++j)
134 {
135 y1[j] = y0[j] + h2 * derivs[i-1][j];
136 }
137 copy(y0, yTemp);
138
139
140 if(i == fsteps / 2 - 1 )
141 {
142 copy(yMid, y1);
143 }
144
146 }
147
148
149
150
151 for (
G4int i = 0; i < fnvar; ++i)
152 {
153 yOut[i] = 0.5 * (y0[i] + y1[i] + h * derivs[fsteps-1][i]);
154 }
155}
◆ GetEquationOfMotion()
◆ GetNumberOfVariables()
G4int G4ModifiedMidpoint::GetNumberOfVariables |
( |
| ) |
const |
|
inline |
◆ GetSteps()
G4int G4ModifiedMidpoint::GetSteps |
( |
| ) |
const |
|
inline |
◆ SetEquationOfMotion()
◆ SetSteps()
void G4ModifiedMidpoint::SetSteps |
( |
G4int |
steps | ) |
|
|
inline |
The documentation for this class was generated from the following files: