Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4CashKarpRKF45.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4CashKarpRKF45.hh 97598 2016-06-06 07:19:46Z gcosmo $
28 //
29 //
30 // class G4CashKarpRKF45
31 //
32 // Class description:
33 //
34 // The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
35 // order method (giving fifth-order accuracy) for the solution of an ODE.
36 // Two different fourth order estimates are calculated; their difference
37 // gives an error estimate. [ref. Numerical Recipes in C, 2nd Edition]
38 // It is used to integrate the equations of the motion of a particle
39 // in a magnetic field.
40 
41 // History:
42 // - Created. J.Apostolakis, V.Grichine - 30.1.97
43 // -------------------------------------------------------------------
44 
45 #ifndef G4CashKARP_RKF45
46 #define G4CashKARP_RKF45
47 
49 
51 {
52 
53  public: // with description
54 
56  G4int numberOfVariables = 6,
57  G4bool primary= true ) ;
59 
60  void Stepper( const G4double y[],
61  const G4double dydx[],
62  G4double h,
63  G4double yout[],
64  G4double yerr[] ) ;
65 
66  public: // without description
67 
68  G4double DistChord() const;
69  G4int IntegratorOrder() const { return 4; }
70 
71  private:
72 
73  void StepWithEst( const G4double yIn[],
74  const G4double dydx[],
75  G4double Step,
76  G4double yOut[],
77  G4double& alpha2,
78  G4double& beta2,
79  const G4double B1[],
80  G4double B2[] );
81  // No longer used. Obsolete.
82 
84  G4CashKarpRKF45& operator=(const G4CashKarpRKF45&);
85  // Private copy constructor and assignment operator.
86 
87  private:
88 
89  G4double *ak2, *ak3, *ak4, *ak5, *ak6, *yTemp, *yIn; // *ak7
90  // scratch space
91 
92  G4double fLastStepLength;
93  G4double *fLastInitialVector, *fLastFinalVector,
94  *fLastDyDx, *fMidVector, *fMidError;
95  // for DistChord calculations
96 
97  G4CashKarpRKF45* fAuxStepper;
98 
99 };
100 
101 #endif /* G4CashKARP_RKF45 */
G4CashKarpRKF45(G4EquationOfMotion *EqRhs, G4int numberOfVariables=6, G4bool primary=true)
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
void Stepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[])
G4int IntegratorOrder() const
G4double DistChord() const
double G4double
Definition: G4Types.hh:76