Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:21

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 // G4VFSALIntegrationStepper
0027 //
0028 // Class description:
0029 //
0030 // Class similar to G4VMagIntegratorStepper, for steppers which
0031 // estimate the value of the derivative at the projected endpoint
0032 // of integration - at each successful step.
0033 // This ability is known as 'First Same As Last' (FSAL). It
0034 // reduces the number of required calls to the equation's 
0035 // RightHandSide method, and, as such the number of calls to the 
0036 // (potentially expensive) field evaluation methods.
0037 //
0038 // Based on G4VMagIntegratorStepper
0039 
0040 // Author: Somnath Banerjee, Google Summer of Code 2015
0041 // Supervision: John Apostolakis, CERN
0042 // --------------------------------------------------------------------
0043 #ifndef G4VFSALINTEGRATOR_STEPPER_HH
0044 #define G4VFSALINTEGRATOR_STEPPER_HH
0045 
0046 #include "G4Types.hh"
0047 #include "G4EquationOfMotion.hh"
0048 
0049 class G4VFSALIntegrationStepper
0050 {
0051   public:  // with description
0052 
0053      G4VFSALIntegrationStepper (G4EquationOfMotion* Equation,
0054                                 G4int               numIntegrationVariables,
0055                                 G4int               numStateVariables = 12);
0056      virtual ~G4VFSALIntegrationStepper() = default;
0057        // Constructor and destructor. No actions.
0058 
0059      G4VFSALIntegrationStepper(const G4VFSALIntegrationStepper&) = delete;
0060      G4VFSALIntegrationStepper& operator=(const G4VFSALIntegrationStepper&) = delete;
0061 
0062      virtual void Stepper( const G4double y[],
0063                            const G4double dydx[],
0064                                  G4double h,
0065                                  G4double yout[],
0066                                  G4double yerr[],
0067                                  G4double lastDydx[]) = 0;
0068        // The stepper for the Runge Kutta integration.
0069        // The stepsize is fixed, with the Step size given by h.
0070        // Integrates ODE starting values y[0 to 6].
0071        // Outputs yout[] and its estimated error yerr[].
0072 
0073      virtual G4double DistChord() const = 0; 
0074        // Estimate the maximum distance of a chord from the true path
0075        // over the segment last integrated.
0076     
0077      inline void NormaliseTangentVector( G4double vec[6] );
0078        // Simple utility function to (re)normalise 'unit velocity' vector.
0079 
0080      inline void NormalisePolarizationVector( G4double vec[12] );
0081        // Simple utility function to (re)normalise 'unit spin' vector.
0082 
0083       void RightHandSide( const double y[], double dydx[] );
0084        // Utility method to supply the standard Evaluation of the
0085        // Right Hand side of the associated equation.
0086 
0087      inline G4int GetNumberOfVariables() const;
0088        // Get the number of variables that the stepper will integrate over.
0089 
0090      inline G4int GetNumberOfStateVariables() const;
0091        // Get the number of variables of state variables (>= above, integration)
0092 
0093      virtual G4int IntegratorOrder() const = 0;
0094        // Returns the order of the integrator
0095        // i.e. its error behaviour is of the order O(h^order).
0096 
0097      inline G4EquationOfMotion* GetEquationOfMotion(); 
0098        // As some steppers (eg RKG3) require other methods of Eq_Rhs
0099        // this function allows for access to them.
0100      inline void SetEquationOfMotion(G4EquationOfMotion* newEquation); 
0101 
0102   public:  // without description
0103 
0104     // Debug functions...
0105 
0106     inline G4int GetfNoRHSCalls() { return fNoRHSCalls; }
0107     void increasefNORHSCalls();
0108     inline void ResetfNORHSCalls() { fNoRHSCalls = 0; }
0109 
0110   private:
0111 
0112     G4EquationOfMotion* fEquation_Rhs = nullptr;
0113     const G4int fNoIntegrationVariables = 0; // Variables in integration
0114     const G4int fNoStateVariables = 0;       // Number required for FieldTrack
0115     
0116     G4int fNoRHSCalls = 0;
0117       // Debug...
0118 };
0119 
0120 #include "G4VFSALIntegrationStepper.icc"
0121 
0122 #endif