Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4VIntegrationDriver
0027 //
0028 // Class description:
0029 //
0030 // Abstract base class for 'driver' classes which are responsible for
0031 // undertaking integration of an state given an equation of motion and
0032 // within acceptable error bound(s).
0033 //
0034 // Different integration methods are meant to be provided via this
0035 // common interface, and can span the original type (explicit Runge Kutta
0036 // methods), enhanced RK methods and alternatives such as the
0037 // Bulirsch-Stoer and multi-step methods.
0038 //
0039 // The drivers' key mission is to insure that the error is below set values. 
0040 
0041 // Author: Dmitry Sorokin, Google Summer of Code 2017
0042 // Supervision: John Apostolakis, CERN
0043 // --------------------------------------------------------------------
0044 #ifndef G4VINTEGRATION_DRIVER_HH
0045 #define G4VINTEGRATION_DRIVER_HH
0046 
0047 #include "G4Types.hh"
0048 #include "G4FieldTrack.hh"
0049 #include "G4EquationOfMotion.hh"
0050 
0051 class G4MagIntegratorStepper;
0052 
0053 class G4VIntegrationDriver
0054 {
0055   public:
0056 
0057     virtual ~G4VIntegrationDriver() = default;
0058 
0059     virtual G4double AdvanceChordLimited(G4FieldTrack& track,
0060                                          G4double hstep,
0061                                          G4double eps,
0062                                          G4double chordDistance) = 0;
0063 
0064     virtual G4bool AccurateAdvance(G4FieldTrack& track,
0065                                    G4double hstep,
0066                                    G4double eps, // Requested y_err/hstep
0067                                    G4double hinitial = 0 ) = 0;
0068 
0069     virtual void SetEquationOfMotion(G4EquationOfMotion* equation) = 0;
0070     virtual G4EquationOfMotion* GetEquationOfMotion() = 0;
0071 
0072     virtual void RenewStepperAndAdjust(G4MagIntegratorStepper* pItsStepper);
0073       // Method for compatibility -- relevant only for G4MagIntegratorDriver
0074    
0075     virtual void SetVerboseLevel(G4int level) = 0;
0076     virtual G4int GetVerboseLevel() const = 0;
0077 
0078     virtual void OnComputeStep(const G4FieldTrack* /*track*/ = nullptr) = 0;
0079 
0080     virtual void OnStartTracking() = 0;
0081 
0082   public:  // without description
0083 
0084     //[[deprecated("will be removed")]]
0085     virtual G4bool QuickAdvance(G4FieldTrack& /*track*/,   // INOUT
0086                                 const G4double /*dydx*/[],
0087                                 G4double /*hstep*/,
0088                                 G4double& /*dchord_step*/,
0089                                 G4double& /*dyerr*/) { return false; }
0090 
0091     //[[deprecated("will be removed")]]
0092     virtual void GetDerivatives(const G4FieldTrack& track,
0093                                 G4double dydx[]) const = 0;
0094 
0095     //[[deprecated("will be removed")]]
0096     virtual void GetDerivatives(const G4FieldTrack& track,
0097                                 G4double dydx[],
0098                                 G4double field[]) const = 0;
0099 
0100     //[[deprecated("use GetEquationOfMotion() instead of GetStepper()->GetEquationOfMotion()")]]
0101     virtual const G4MagIntegratorStepper* GetStepper() const = 0;
0102     virtual G4MagIntegratorStepper* GetStepper() = 0;
0103 
0104     //[[deprecated("will be removed")]]
0105     virtual G4double ComputeNewStepSize(G4double errMaxNorm, // normalised error
0106                                         G4double hstepCurrent) = 0;
0107       // Taking the last step's normalised error, calculate
0108       // a step size for the next step.
0109       // - Can limit the next step's size within a factor of the current one.
0110 
0111     virtual G4bool DoesReIntegrate() const = 0;
0112       // Whether the driver implementates re-integration
0113       //  - original Integration driver will re-start and re-calculate interval => yes
0114       //  - Interpolation Driver does not recalculate (it interpolates)
0115       // Basically answer: does this driver *Recalculate* when AccurateAdvance is called ?
0116 
0117     virtual void   StreamInfo( std::ostream& os ) const = 0;
0118       // Write out the parameters / state of the driver
0119 
0120     friend std::ostream& operator<<( std::ostream& os, const G4VIntegrationDriver& id);
0121    
0122   protected:
0123 
0124     static constexpr G4double max_stepping_increase = 5;
0125     static constexpr G4double max_stepping_decrease = 0.1;
0126 };
0127 
0128 #endif