48 G4int noIntegrationVariables,
51 fLastStepLength(0.), fAuxStepper(0)
53 const G4int numberOfVariables = noIntegrationVariables;
55 ak2 =
new G4double[numberOfVariables] ;
56 ak3 =
new G4double[numberOfVariables] ;
57 ak4 =
new G4double[numberOfVariables] ;
58 ak5 =
new G4double[numberOfVariables] ;
59 ak6 =
new G4double[numberOfVariables] ;
61 yTemp =
new G4double[numberOfVariables] ;
62 yIn =
new G4double[numberOfVariables] ;
64 fLastInitialVector =
new G4double[numberOfVariables] ;
65 fLastFinalVector =
new G4double[numberOfVariables] ;
66 fLastDyDx =
new G4double[numberOfVariables];
68 fMidVector =
new G4double[numberOfVariables];
69 fMidError =
new G4double[numberOfVariables];
91 delete[] fLastInitialVector;
92 delete[] fLastFinalVector;
122 b31 = 3.0/40.0 , b32 = 9.0/40.0 ,
123 b41 = 0.3 , b42 = -0.9 , b43 = 1.2 ,
125 b51 = -11.0/54.0 , b52 = 2.5 , b53 = -70.0/27.0 ,
128 b61 = 1631.0/55296.0 , b62 = 175.0/512.0 ,
129 b63 = 575.0/13824.0 , b64 = 44275.0/110592.0 ,
132 c1 = 37.0/378.0 , c3 = 250.0/621.0 , c4 = 125.0/594.0 ,
134 dc5 = -277.0/14336.0 ;
136 const G4double dc1 =
c1 - 2825.0/27648.0 , dc3 = c3 - 18575.0/48384.0 ,
137 dc4 = c4 - 13525.0/55296.0 , dc6 = c6 - 0.25 ;
142 yOut[7] = yTemp[7] = yIn[7];
149 for(i=0;i<numberOfVariables;i++)
155 for(i=0;i<numberOfVariables;i++)
157 yTemp[i] = yIn[i] + b21*Step*dydx[i] ;
161 for(i=0;i<numberOfVariables;i++)
163 yTemp[i] = yIn[i] + Step*(b31*dydx[i] + b32*ak2[i]) ;
167 for(i=0;i<numberOfVariables;i++)
169 yTemp[i] = yIn[i] + Step*(b41*dydx[i] + b42*ak2[i] + b43*ak3[i]) ;
173 for(i=0;i<numberOfVariables;i++)
175 yTemp[i] = yIn[i] + Step*(b51*dydx[i] + b52*ak2[i] + b53*ak3[i] +
180 for(i=0;i<numberOfVariables;i++)
182 yTemp[i] = yIn[i] + Step*(b61*dydx[i] + b62*ak2[i] + b63*ak3[i] +
183 b64*ak4[i] + b65*ak5[i]) ;
187 for(i=0;i<numberOfVariables;i++)
191 yOut[i] = yIn[i] + Step*(
c1*dydx[i] + c3*ak3[i] + c4*ak4[i] + c6*ak6[i]) ;
196 yErr[i] = Step*(dc1*dydx[i] + dc3*ak3[i] + dc4*ak4[i] +
197 dc5*ak5[i] + dc6*ak6[i]) ;
200 fLastInitialVector[i] = yIn[i] ;
201 fLastFinalVector[i] = yOut[i];
202 fLastDyDx[i] = dydx[i];
206 fLastStepLength =Step;
214 G4CashKarpRKF45::StepWithEst(
const G4double*,
223 G4Exception(
"G4CashKarpRKF45::StepWithEst()",
"GeomField0001",
237 fLastInitialVector[1], fLastInitialVector[2]);
239 fLastFinalVector[1], fLastFinalVector[2]);
243 fAuxStepper->
Stepper( fLastInitialVector, fLastDyDx, 0.5 * fLastStepLength,
244 fMidVector, fMidError );
246 midPoint =
G4ThreeVector( fMidVector[0], fMidVector[1], fMidVector[2]);
252 if (initialPoint != finalPoint)
255 distChord = distLine;
259 distChord = (midPoint-initialPoint).mag();
CLHEP::Hep3Vector G4ThreeVector
G4CashKarpRKF45(G4EquationOfMotion *EqRhs, G4int numberOfVariables=6, G4bool primary=true)
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
G4int GetNumberOfVariables() const
void Stepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[])
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double DistChord() const
void RightHandSide(const double y[], double dydx[])