Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4VFSALIntegrationStepper.hh
이 파일의 문서화 페이지로 가기
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: G4VFSALIntegrationStepper.hh
27 //
28 // class G4VFSALIntegrationStepper
29 //
30 // Class description:
31 // Class similar to G4VMagIntegratorStepper, for steppers which
32 // estimate the value of the derivative at the projected endpoint
33 // of integration - at each successful step.
34 // This ability is known as 'First Same As Last' (FSAL). It
35 // reduces the number of required calls to the equation's
36 // RightHandSide method, and, as such the number of calls to the
37 // (potentially expensive) field evaluation methods.
38 //
39 // Based on G4VMagIntegratorStepper
40 //
41 // Design/first implementation: Somnath Banerjee, May-Aug 2015,
42 // Work supported by the Google Summer of Code 2015.
43 // Supervision/improvement: John Apostolakis 2015-2016
44 // --------------------------------------------------------------------
45 
46 #ifndef FSAL_MAGIntegrator_STEPPER
47 #define FSAL_MAGIntegrator_STEPPER
48 
49 #include "G4Types.hh"
50 #include "G4EquationOfMotion.hh"
51 
53 {
54  public: // with description
55 
57  G4int numIntegrationVariables,
58  G4int numStateVariables=12);
59 
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[],
68  G4double lastDydx[]) = 0 ;
69  // The stepper for the Runge Kutta integration.
70  // The stepsize is fixed, with the Step size given by h.
71  // Integrates ODE starting values y[0 to 6].
72  // Outputs yout[] and its estimated error yerr[].
73 
74  virtual G4double DistChord() const = 0;
75  // Estimate the maximum distance of a chord from the true path
76  // over the segment last integrated.
77 
78  virtual void ComputeRightHandSide( const G4double y[], G4double dydx[] );
79  // Must compute the RightHandSide as in the method below
80  // Optionally can cache the input y[] and the dydx[] values computed.
81 
82 // virtual G4bool isFSAL() const = 0;
83 // //Return true if the stepper uses FSAL (First Same As Last)
84 
85 // G4double *getLastDydx() {return 0;}
86 
87  inline void NormaliseTangentVector( G4double vec[6] );
88  // Simple utility function to (re)normalise 'unit velocity' vector.
89 
90  inline void NormalisePolarizationVector( G4double vec[12] );
91  // Simple utility function to (re)normalise 'unit spin' vector.
92 
93  void RightHandSide( const double y[], double dydx[] );
94  // Utility method to supply the standard Evaluation of the
95  // Right Hand side of the associated equation.
96 
97 
98  inline G4int GetNumberOfVariables() const;
99  // Get the number of variables that the stepper will integrate over.
100 
101  // void SetNumberOfVariables(G4int newNo); // Dangerous & obsolete ...
102 
103  inline G4int GetNumberOfStateVariables() const;
104  // Get the number of variables of state variables (>= above, integration)
105 
106  virtual G4int IntegratorOrder() const = 0;
107  // Returns the order of the integrator
108  // i.e. its error behaviour is of the order O(h^order).
109 
111  // As some steppers (eg RKG3) require other methods of Eq_Rhs
112  // this function allows for access to them.
113  inline void SetEquationOfMotion(G4EquationOfMotion* newEquation);
114 
115  //--- --- For DEBUG --- ---
117  return fNoRHSCalls;
118  }
119  void increasefNORHSCalls();
120 
121  inline void ResetfNORHSCalls(){
122  fNoRHSCalls = 0;
123  }
124  //--- --- ///////// --- ---
125  private:
126 
129  // Private copy constructor and assignment operator.
130 
131  private:
132 
134  const G4int fNoIntegrationVariables; // Number of Variables in integration
135  const G4int fNoStateVariables; // Number required for FieldTrack
136 
137 
138  //--- --- For DEBUG --- ---
140  //--- --- ///////// --- ---
141 
142  // const G4int fNumberOfVariables;
143 
144 };
145 
146 #include "G4VFSALIntegrationStepper.icc"
147 
148 #endif /* G4VFSALIntegrationStepper */
void SetEquationOfMotion(G4EquationOfMotion *newEquation)
void RightHandSide(const double y[], double dydx[])
virtual G4int IntegratorOrder() const =0
G4VFSALIntegrationStepper(G4EquationOfMotion *Equation, G4int numIntegrationVariables, G4int numStateVariables=12)
virtual void ComputeRightHandSide(const G4double y[], G4double dydx[])
Float_t y
Definition: compare.C:6
G4int GetNumberOfVariables() const
double G4double
Definition: G4Types.hh:76
void NormalisePolarizationVector(G4double vec[12])
void NormaliseTangentVector(G4double vec[6])
int G4int
Definition: G4Types.hh:78
G4VFSALIntegrationStepper & operator=(const G4VFSALIntegrationStepper &)
G4int GetNumberOfStateVariables() const
virtual G4double DistChord() const =0
G4EquationOfMotion * GetEquationOfMotion()
virtual void Stepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[], G4double lastDydx[])=0