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