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 | // $Id: G4MagIntegratorStepper.hh,v 1.12 2006/09/20 09:31:01 japost Exp $ |
---|
27 | // GEANT4 tag $Name: $ |
---|
28 | // |
---|
29 | // |
---|
30 | // class G4MagIntegratorStepper |
---|
31 | // |
---|
32 | // Class description: |
---|
33 | // |
---|
34 | // Abstract base class for integrator of particle's equation of motion, |
---|
35 | // used in tracking in space dependent magnetic field |
---|
36 | // |
---|
37 | // A Stepper must integrate over NumberOfVariables elements, |
---|
38 | // and also copy (from input to output) any of NoStateVariables |
---|
39 | // not included in the NumberOfVariables. |
---|
40 | // |
---|
41 | // So it is expected that NoStateVariables >= NumberOfVariables |
---|
42 | |
---|
43 | // History: |
---|
44 | // - 15.01.97 J. Apostolakis (J.Apostolakis@cern.ch) |
---|
45 | // -------------------------------------------------------------------- |
---|
46 | |
---|
47 | #ifndef G4MAGIntegratorSTEPPER |
---|
48 | #define G4MAGIntegratorSTEPPER |
---|
49 | |
---|
50 | #include "G4Types.hh" |
---|
51 | #include "G4EquationOfMotion.hh" |
---|
52 | |
---|
53 | class G4MagIntegratorStepper |
---|
54 | { |
---|
55 | public: // with description |
---|
56 | |
---|
57 | G4MagIntegratorStepper(G4EquationOfMotion *Equation, |
---|
58 | G4int numIntegrationVariables, |
---|
59 | G4int numStateVariables=12); |
---|
60 | virtual ~G4MagIntegratorStepper(); |
---|
61 | // Constructor and destructor. No actions. |
---|
62 | |
---|
63 | virtual void Stepper( const G4double y[], |
---|
64 | const G4double dydx[], |
---|
65 | G4double h, |
---|
66 | G4double yout[], |
---|
67 | G4double yerr[] ) = 0 ; |
---|
68 | // The stepper for the Runge Kutta integration. |
---|
69 | // The stepsize is fixed, with the Step size given by h. |
---|
70 | // Integrates ODE starting values y[0 to 6]. |
---|
71 | // Outputs yout[] and its estimated error yerr[]. |
---|
72 | |
---|
73 | virtual G4double DistChord() const = 0; |
---|
74 | // Estimate the maximum distance of a chord from the true path |
---|
75 | // over the segment last integrated. |
---|
76 | |
---|
77 | inline void NormaliseTangentVector( G4double vec[6] ); |
---|
78 | // Simple utility function to (re)normalise 'unit velocity' vector. |
---|
79 | |
---|
80 | inline void RightHandSide( const double y[], double dydx[] ); |
---|
81 | // Utility method to supply the standard Evaluation of the |
---|
82 | // Right Hand side of the associated equation. |
---|
83 | |
---|
84 | inline G4int GetNumberOfVariables() const; |
---|
85 | // Get the number of variables that the stepper will integrate over. |
---|
86 | |
---|
87 | // void SetNumberOfVariables(G4int newNo); // Dangerous & obsolete ... |
---|
88 | |
---|
89 | inline G4int GetNumberOfStateVariables() const; |
---|
90 | // Get the number of variables of state variables (>= above, integration) |
---|
91 | |
---|
92 | virtual G4int IntegratorOrder() const = 0; |
---|
93 | // Returns the order of the integrator |
---|
94 | // i.e. its error behaviour is of the order O(h^order). |
---|
95 | |
---|
96 | inline G4EquationOfMotion *GetEquationOfMotion(); |
---|
97 | // As some steppers (eg RKG3) require other methods of Eq_Rhs |
---|
98 | // this function allows for access to them. |
---|
99 | inline void SetEquationOfMotion(G4EquationOfMotion* newEquation); |
---|
100 | |
---|
101 | private: |
---|
102 | |
---|
103 | G4MagIntegratorStepper(const G4MagIntegratorStepper&); |
---|
104 | G4MagIntegratorStepper& operator=(const G4MagIntegratorStepper&); |
---|
105 | // Private copy constructor and assignment operator. |
---|
106 | |
---|
107 | private: |
---|
108 | |
---|
109 | G4EquationOfMotion *fEquation_Rhs; |
---|
110 | const G4int fNoIntegrationVariables; // Number of Variables in integration |
---|
111 | const G4int fNoStateVariables; // Number required for FieldTrack |
---|
112 | // const G4int fNumberOfVariables; |
---|
113 | }; |
---|
114 | |
---|
115 | #include "G4MagIntegratorStepper.icc" |
---|
116 | |
---|
117 | #endif /* G4MAGIntegratorSTEPPER */ |
---|