|
|
|||
File indexing completed on 2026-09-15 09:10:17
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 (CERN, Google Summer of Code 2017), 20.10.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 /** 0058 * Default Destructor. 0059 */ 0060 virtual ~G4VIntegrationDriver() = default; 0061 0062 /** 0063 * Computes the step to take, based on chord limits. 0064 * @param[in,out] track The current track in field. 0065 * @param[in] hstep Proposed step length. 0066 * @param[in] eps Requested accuracy, y_err/hstep. 0067 * @param[in] chordDistance Maximum sagitta distance. 0068 * @returns The length of step taken. 0069 */ 0070 virtual G4double AdvanceChordLimited(G4FieldTrack& track, 0071 G4double hstep, 0072 G4double eps, 0073 G4double chordDistance) = 0; 0074 0075 /** 0076 * Advances integration accurately by relative accuracy better than 'eps'. 0077 * On output the track is replaced by the value at the end of interval. 0078 * @param[in,out] track The current track in field. 0079 * @param[in] hstep Proposed step length. 0080 * @param[in] eps Requested accuracy, y_err/hstep. 0081 * @param[in] hinitial Initial minimum integration step. 0082 * @returns true if integration succeeds. 0083 */ 0084 virtual G4bool AccurateAdvance(G4FieldTrack& track, 0085 G4double hstep, 0086 G4double eps, // Requested y_err/hstep 0087 G4double hinitial = 0 ) = 0; 0088 0089 /** 0090 * Setter and getter for the equation of motion. 0091 */ 0092 virtual void SetEquationOfMotion(G4EquationOfMotion* equation) = 0; 0093 virtual G4EquationOfMotion* GetEquationOfMotion() = 0; 0094 0095 /** 0096 * Method for compatibility -- relevant only for G4MagIntegratorDriver. 0097 */ 0098 virtual void RenewStepperAndAdjust(G4MagIntegratorStepper* pItsStepper); 0099 0100 /** 0101 * Setter and getter for verbosity. 0102 */ 0103 virtual void SetVerboseLevel(G4int level) = 0; 0104 virtual G4int GetVerboseLevel() const = 0; 0105 0106 /** 0107 * Dispatch interface method for computing step. 0108 */ 0109 virtual void OnComputeStep(const G4FieldTrack* /*track*/ = nullptr) = 0; 0110 0111 /** 0112 * Dispatch interface method for initialisation/reset of driver. 0113 */ 0114 virtual void OnStartTracking() = 0; 0115 0116 /** 0117 * Whether the driver implements re-integration: 0118 * Does this driver *Recalculate* when AccurateAdvance() is called ? 0119 */ 0120 virtual G4bool DoesReIntegrate() const = 0; 0121 0122 /** 0123 * Writes out to stream the parameters/state of the driver. 0124 */ 0125 virtual void StreamInfo( std::ostream& os ) const = 0; 0126 0127 /** 0128 * Streaming operator. 0129 */ 0130 friend std::ostream& operator<<( std::ostream& os, const G4VIntegrationDriver& id); 0131 0132 // ------------------------------------------------------------------------ 0133 0134 //[[deprecated("will be removed")]] 0135 virtual G4bool QuickAdvance(G4FieldTrack& /*track*/, // INOUT 0136 const G4double /*dydx*/[], 0137 G4double /*hstep*/, 0138 G4double& /*dchord_step*/, 0139 G4double& /*dyerr*/) { return false; } 0140 0141 //[[deprecated("will be removed")]] 0142 virtual void GetDerivatives(const G4FieldTrack& track, 0143 G4double dydx[]) const = 0; 0144 0145 //[[deprecated("will be removed")]] 0146 virtual void GetDerivatives(const G4FieldTrack& track, 0147 G4double dydx[], 0148 G4double field[]) const = 0; 0149 0150 //[[deprecated("use GetEquationOfMotion() instead of GetStepper()->GetEquationOfMotion()")]] 0151 virtual const G4MagIntegratorStepper* GetStepper() const = 0; 0152 virtual G4MagIntegratorStepper* GetStepper() = 0; 0153 0154 //[[deprecated("will be removed")]] 0155 virtual G4double ComputeNewStepSize(G4double errMaxNorm, // normalised error 0156 G4double hstepCurrent) = 0; 0157 // Taking the last step's normalised error, calculate 0158 // a step size for the next step. 0159 // - Can limit the next step's size within a factor of the current one. 0160 0161 protected: 0162 0163 static constexpr G4double max_stepping_increase = 5; 0164 static constexpr G4double max_stepping_decrease = 0.1; 0165 }; 0166 0167 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|