37#ifndef G4TMAG_ERROR_STEPPER_HH
38#define G4TMAG_ERROR_STEPPER_HH
45template <
class T_Stepper,
class T_Equation,
unsigned int N>
50 G4int numStateVariables = 12)
52 , fEquation_Rhs(EqRhs)
61 fEquation_Rhs->T_Equation::RightHandSide(y, dydx);
88 T_Equation* fEquation_Rhs;
93template <class T_Stepper, class T_Equation,
unsigned int N >
108 for(
unsigned int i = 0; i < N; ++i)
109 yInitial[i] = yInput[i];
112 yMiddle[7] = yInput[7];
113 yOneStep[7] = yInput[7];
115 for(
unsigned int i = N; i < maxvar; ++i)
116 yOutput[i] = yInput[i];
122 static_cast<T_Stepper*
>(
this)->DumbStepper(yInitial, dydx, halfStep,
125 static_cast<T_Stepper*
>(
this)->DumbStepper(yMiddle, dydxMid, halfStep,
130 fMidPoint =
G4ThreeVector(yMiddle[0], yMiddle[1], yMiddle[2]);
133 static_cast<T_Stepper*
>(
this)->DumbStepper(yInitial, dydx, hstep, yOneStep);
134 for(
unsigned int i = 0; i < N; ++i)
136 yError[i] = yOutput[i] - yOneStep[i];
139 T_Stepper::IntegratorCorrection;
144 fInitialPoint =
G4ThreeVector(yInitial[0], yInitial[1], yInitial[2]);
145 fFinalPoint =
G4ThreeVector(yOutput[0], yOutput[1], yOutput[2]);
151template <
class T_Stepper,
class T_Equation,
unsigned int N >
165 if(fInitialPoint != fFinalPoint)
171 distChord = distLine;
175 distChord = (fMidPoint - fInitialPoint).mag();
CLHEP::Hep3Vector G4ThreeVector
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
G4int GetNumberOfStateVariables() const
G4double DistChord() const override final
G4TMagErrorStepper(T_Equation *EqRhs, G4int numberOfVariables, G4int numStateVariables=12)
virtual ~G4TMagErrorStepper()
void RightHandSide(G4double y[], G4double dydx[])
void Stepper(const G4double yInput[], const G4double dydx[], G4double hstep, G4double yOutput[], G4double yError[]) override final