Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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// G4CashKarpRKF45
27//
28// Class description:
29//
30// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
31// order method (giving fifth-order accuracy) for the solution of an ODE.
32// Two different fourth order estimates are calculated; their difference
33// gives an error estimate. [ref. Numerical Recipes in C, 2nd Edition]
34// It is used to integrate the equations of the motion of a particle
35// in a magnetic field.
36
37// Authors: J.Apostolakis, V.Grichine - 30.01.1997
38// -------------------------------------------------------------------
39#ifndef G4CASHKARP_RKF45_HH
40#define G4CASHKARP_RKF45_HH
41
43
45{
46
47 public: // with description
48
50 G4int numberOfVariables = 6,
51 G4bool primary = true ) ;
53
54 void Stepper( const G4double y[],
55 const G4double dydx[],
56 G4double h,
57 G4double yout[],
58 G4double yerr[] ) ;
59
60 public: // without description
61
62 G4double DistChord() const;
63 G4int IntegratorOrder() const { return 4; }
64
65 private:
66
67 void StepWithEst( const G4double yIn[],
68 const G4double dydx[],
69 G4double Step,
70 G4double yOut[],
71 G4double& alpha2,
72 G4double& beta2,
73 const G4double B1[],
74 G4double B2[] );
75 // No longer used. Obsolete.
76
78 G4CashKarpRKF45& operator=(const G4CashKarpRKF45&);
79 // Private copy constructor and assignment operator.
80
81 private:
82
83 G4double *ak2, *ak3, *ak4, *ak5, *ak6, *yTemp, *yIn; // *ak7
84 // scratch space
85
86 G4double fLastStepLength = 0.0;
87 G4double *fLastInitialVector, *fLastFinalVector,
88 *fLastDyDx, *fMidVector, *fMidError;
89 // for DistChord calculations
90
91 G4CashKarpRKF45* fAuxStepper = nullptr;
92
93};
94
95#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void Stepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[])
G4double DistChord() const
G4int IntegratorOrder() const