Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4MagIntegratorStepper.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4MagIntegratorStepper
0027 //
0028 // Class description:
0029 //
0030 // Abstract base class for integrator of particle's equation of motion,
0031 // used in tracking in space dependent magnetic field
0032 //
0033 // A Stepper must integrate over NumberOfVariables elements,
0034 // and also copy (from input to output) any of NoStateVariables  
0035 // not included in the NumberOfVariables.  
0036 // 
0037 // So it is expected that NoStateVariables >= NumberOfVariables
0038 
0039 // Author: J.Apostolakis, CERN - 15.01.1997
0040 // --------------------------------------------------------------------
0041 #ifndef G4MAGINTEGRATORSTEPPER_HH
0042 #define G4MAGINTEGRATORSTEPPER_HH
0043 
0044 #include "G4Types.hh"
0045 #include "G4EquationOfMotion.hh"
0046 #include "G4VIntegrationDriver.hh"
0047 #include "G4IntegrationDriver.hh"
0048 
0049 class G4VIntegrationDriver;
0050 
0051 class G4MagIntegratorStepper
0052 {
0053   public:  // with description
0054 
0055      G4MagIntegratorStepper(G4EquationOfMotion* Equation, 
0056                             G4int               numIntegrationVariables,
0057                             G4int               numStateVariables = 12,
0058                             G4bool              isFSAL = false );
0059 
0060      virtual ~G4MagIntegratorStepper() = default;
0061        // Constructor and destructor. No actions.
0062 
0063      G4MagIntegratorStepper(const G4MagIntegratorStepper&) = delete;
0064      G4MagIntegratorStepper& operator=(const G4MagIntegratorStepper&) = delete;
0065 
0066      virtual void Stepper( const G4double y[],
0067                            const G4double dydx[],
0068                                  G4double h,
0069                                  G4double yout[],
0070                                  G4double yerr[] ) = 0;
0071        // The stepper for the Runge Kutta integration.
0072        // The stepsize is fixed, with the Step size given by h.
0073        // Integrates ODE starting values y[0 to 6].
0074        // Outputs yout[] and its estimated error yerr[].
0075 
0076      virtual G4double DistChord() const = 0;
0077        // Estimate the maximum distance of a chord from the true path
0078        // over the segment last integrated.
0079 
0080      inline void NormaliseTangentVector( G4double vec[6] );
0081        // Simple utility function to (re)normalise 'unit velocity' vector.
0082 
0083      inline void NormalisePolarizationVector( G4double vec[12] );
0084        // Simple utility function to (re)normalise 'unit spin' vector.
0085 
0086      inline void RightHandSide( const G4double y[], G4double dydx[] ) const;
0087        // Utility method to supply the standard Evaluation of the
0088        // Right Hand side of the associated equation.
0089 
0090      inline void RightHandSide( const G4double y[],
0091                                       G4double dydx[],
0092                                       G4double field[] ) const;
0093        // Calculate dydx and field at point y. 
0094 
0095      inline G4int  GetNumberOfVariables() const;
0096        // Get the number of variables that the stepper will integrate over.
0097 
0098      inline G4int  GetNumberOfStateVariables() const;
0099        // Get the number of variables of state variables (>= above, integration)
0100 
0101      virtual G4int IntegratorOrder() const = 0;
0102        // Returns the order of the integrator
0103        // i.e. its error behaviour is of the order O(h^order).
0104 
0105      inline G4int IntegrationOrder();
0106        // Replacement method - using new data member
0107    
0108      inline G4EquationOfMotion* GetEquationOfMotion();
0109      inline const G4EquationOfMotion* GetEquationOfMotion() const;
0110        // As some steppers (eg RKG3) require other methods of Eq_Rhs
0111        // this function allows for access to them.
0112 
0113      inline void SetEquationOfMotion(G4EquationOfMotion* newEquation); 
0114 
0115      inline unsigned long GetfNoRHSCalls();
0116      inline void ResetfNORHSCalls();
0117        // Count number of calls to RHS method(s)
0118 
0119      inline G4bool IsFSAL() const;
0120 
0121      // TODO - QSS
0122      inline G4bool isQSS() const { return fIsQSS; }
0123      void   SetIsQSS(G4bool val){ fIsQSS= val;}
0124 
0125 protected:
0126 
0127      inline void SetIntegrationOrder(G4int order);
0128      inline void SetFSAL(G4bool flag = true);
0129    
0130   private:
0131 
0132      G4EquationOfMotion* fEquation_Rhs = nullptr;
0133      const G4int fNoIntegrationVariables = 0; // Variables in integration
0134      const G4int fNoStateVariables = 0;       // Number required for FieldTrack
0135 
0136      mutable unsigned long fNoRHSCalls = 0UL;
0137        // Counter for calls to RHS method
0138 
0139      // Parameters of a RK method -- must be shared by all steppers of a type
0140      // -- Invariants for a class
0141  
0142      G4int fIntegrationOrder = -1;  // must be set by stepper !!!
0143       // All ClassicalRK4 steppers are 4th order
0144      G4bool fIsFSAL = false;
0145       // Depends on RK method & implementation
0146      G4bool fIsQSS = false;
0147 
0148 };
0149 
0150 #include  "G4MagIntegratorStepper.icc"
0151 
0152 #endif  /* G4MAGIntegratorSTEPPER */