38 : fEquation(equation), fnvar(nvar), fsteps(steps)
42 G4Exception(
"G4ModifiedMidpoint::G4ModifiedMidpoint()",
44 "Invalid number of variables; must be greater than zero!");
54 setValue(yIn, Value1D::LabTime, y0, y1, yTemp, yOut);
63 for (
G4int i = 0; i < fnvar; ++i)
65 y1[i] = yIn[i] + h * dydyIn[i];
75 for (
G4int i = 1; i < fsteps; ++i)
78 for (
G4int j = 0; j < fnvar; ++j)
80 y1[j] = y0[j] + h2 * dydx[j];
90 for (
G4int i = 0; i < fnvar; ++i)
92 yOut[i] = 0.5 * (y0[i] + y1[i] + h * dydx[i]);
103 setValue(yIn, Value1D::LabTime, y0, y1, yTemp, yMid, yOut);
112 for (
G4int i = 0; i < fnvar; ++i)
114 y1[i] = y0[i] + h * dydxIn[i];
130 for (
G4int i = 1; i < fsteps; ++i)
133 for (
G4int j = 0; j < fnvar; ++j)
135 y1[j] = y0[j] + h2 * derivs[i-1][j];
140 if(i == fsteps / 2 - 1 )
151 for (
G4int i = 0; i < fnvar; ++i)
153 yOut[i] = 0.5 * (y0[i] + y1[i] + h * derivs[fsteps-1][i]);
159 std::memcpy(dst, src,
sizeof(
G4double) * fnvar);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void RightHandSide(const G4double y[], G4double dydx[]) const
G4ModifiedMidpoint(G4EquationOfMotion *equation, G4int nvar=6, G4int steps=2)
void DoStep(const G4double yIn[], const G4double dydxIn[], G4double yOut[], G4double hstep) const
void setValue(const SourceArray &src, Value1D value, TargetArray &trg)