|
|
|||
File indexing completed on 2026-09-26 08:56:02
0001 // ******************************************************************** 0002 // * License and Disclaimer * 0003 // * * 0004 // * The Geant4 software is copyright of the Copyright Holders of * 0005 // * the Geant4 Collaboration. It is provided under the terms and * 0006 // * conditions of the Geant4 Software License, included in the file * 0007 // * LICENSE and available at http://cern.ch/geant4/license . These * 0008 // * include a list of copyright holders. * 0009 // * * 0010 // * Neither the authors of this software system, nor their employing * 0011 // * institutes,nor the agencies providing financial support for this * 0012 // * work make any representation or warranty, express or implied, * 0013 // * regarding this software system or assume any liability for its * 0014 // * use. Please see the license in the file LICENSE and URL above * 0015 // * for the full disclaimer and the limitation of liability. * 0016 // * * 0017 // * This code implementation is the result of the scientific and * 0018 // * technical work of the GEANT4 collaboration. * 0019 // * By using, copying, modifying or distributing the software (or * 0020 // * any work based on the software) you agree to acknowledge its * 0021 // * use in resulting scientific publications, and indicate your * 0022 // * acceptance of all terms of the Geant4 Software license. * 0023 // ******************************************************************** 0024 // 0025 // G4BulirschStoer driver 0026 // 0027 // Class description: 0028 // 0029 // G4IntegrationDriver<G4BulirschStoer> is a concrete driver class using 0030 // Bulirsch-Stoer method to integrate the equation of motion. 0031 0032 // Author: Dmitry Sorokin (CERN, Google Summer of Code 2016), 13.02.2018 0033 // Supervision: John Apostolakis (CERN) 0034 // -------------------------------------------------------------------- 0035 #ifndef G4BULIRSCH_STOER_DRIVER_HH 0036 #define G4BULIRSCH_STOER_DRIVER_HH 0037 0038 #include "G4IntegrationDriver.hh" 0039 #include "G4BulirschStoer.hh" 0040 #include "G4ChordFinderDelegate.hh" 0041 0042 /** 0043 * @brief G4IntegrationDriver<G4BulirschStoer> is a concrete driver class 0044 * using the Bulirsch-Stoer method to integrate the equation of motion. 0045 */ 0046 0047 template <> 0048 class G4IntegrationDriver<G4BulirschStoer>: 0049 public G4VIntegrationDriver, 0050 public G4ChordFinderDelegate<G4IntegrationDriver<G4BulirschStoer>> 0051 { 0052 public: 0053 0054 /** 0055 * Constructor for the concrete G4IntegrationDriver. 0056 * @param[in] hminimum The minumum allowed step.. 0057 * @param[in] Boris Pointer to the Bulirsch-Stoer motion algorithm. 0058 * @param[in] numberOfComponents The number of integration variables. 0059 * @param[in] verbosity Flag for verbosity. 0060 */ 0061 G4IntegrationDriver( G4double hminimum, 0062 G4BulirschStoer* stepper, 0063 G4int numberOfComponents = 6, 0064 G4int statisticsVerbosity = 1); 0065 0066 /** 0067 * Default Destructor. 0068 */ 0069 ~G4IntegrationDriver() = default; 0070 0071 /** 0072 * Copy constructor and assignment operator not allowed. 0073 */ 0074 G4IntegrationDriver(const G4IntegrationDriver&) = delete; 0075 G4IntegrationDriver& operator=(const G4IntegrationDriver&) = delete; 0076 0077 /** 0078 * Computes the step to take, based on chord limits. 0079 * @param[in,out] track The current track in field. 0080 * @param[in] hstep Proposed step length. 0081 * @param[in] eps Requested accuracy, y_err/hstep. 0082 * @param[in] chordDistance Maximum sagitta distance. 0083 * @returns The length of step taken. 0084 */ 0085 G4double AdvanceChordLimited(G4FieldTrack& track, 0086 G4double hstep, 0087 G4double eps, 0088 G4double chordDistance) override; 0089 0090 /** 0091 * Dispatch interface method for initialisation/reset of driver. 0092 */ 0093 void OnStartTracking() override; 0094 0095 /** 0096 * Dispatch interface method for computing step. Does nothing here. 0097 */ 0098 void OnComputeStep(const G4FieldTrack* track = nullptr) override; 0099 0100 /** 0101 * The driver does not implement re-integration. Returns false. 0102 */ 0103 G4bool DoesReIntegrate() const override; 0104 0105 /** 0106 * Advances integration accurately by relative accuracy better than 'eps'. 0107 * @param[in,out] track The current track in field. 0108 * @param[in] stepLen Proposed step length. 0109 * @param[in] eps Requested accuracy, y_err/hstep. 0110 * @param[in] beginStep Initial minimum integration step. 0111 * @returns true if integration succeeds. 0112 */ 0113 G4bool AccurateAdvance( G4FieldTrack& track, 0114 G4double stepLen, 0115 G4double eps, 0116 G4double beginStep = 0) override; 0117 0118 /** 0119 * Attempts one integration step, and returns estimated error 'dyerr'. 0120 * It does not ensure accuracy. 0121 * @param[in,out] y_val The current track in field. 0122 * @param[in] dydx dydx array. 0123 * @param[in] hstep Proposed step length. 0124 * @param[out] missDist Estimated sagitta distance. 0125 * @param[out] dyerr Estimated error. 0126 * @returns true if integration succeeds. 0127 */ 0128 G4bool QuickAdvance( G4FieldTrack& y_val, 0129 const G4double dydx[], 0130 G4double hstep, 0131 G4double& missDist, 0132 G4double& dyerr) override; 0133 0134 /** 0135 * Takes one Step that is as large as possible while satisfying the 0136 * accuracy criterion. 0137 * @param[in,out] y The current track state, y. 0138 * @param[in] dydx dydx array. 0139 * @param[in,out] curveLength Step start, x. 0140 * @param[in] htry Step to attempt. 0141 * @param[in] eps The relative accuracy. 0142 * @param[out] hdid Step achieved. 0143 * @param[out] hnext Proposed next step. 0144 */ 0145 void OneGoodStep( G4double y[], 0146 const G4double dydx[], 0147 G4double& curveLength, 0148 G4double htry, 0149 G4double eps, 0150 G4double& hdid, 0151 G4double& hnext); 0152 0153 /** 0154 * Getters for derivatives. 0155 */ 0156 void GetDerivatives( const G4FieldTrack& track, 0157 G4double dydx[]) const override; 0158 void GetDerivatives( const G4FieldTrack& track, 0159 G4double dydx[], 0160 G4double field[]) const override; 0161 0162 /** 0163 * Setter and getter for verbosity. 0164 */ 0165 void SetVerboseLevel(G4int level) override; 0166 G4int GetVerboseLevel() const override; 0167 0168 /** 0169 * Computes the new step size . 0170 * @param[in] errMaxNorm The normalised error. 0171 * @param[in] hstepCurrent The current step size. 0172 * @returns The new step size. 0173 */ 0174 G4double ComputeNewStepSize(G4double errMaxNorm, 0175 G4double hstepCurrent) override; 0176 0177 /** 0178 * Getters and setter for the equation of motion. 0179 */ 0180 G4EquationOfMotion* GetEquationOfMotion() override; 0181 const G4EquationOfMotion* GetEquationOfMotion() const; 0182 void SetEquationOfMotion(G4EquationOfMotion* equation) override; 0183 0184 /** 0185 * Getters for the stepper. 0186 */ 0187 const G4MagIntegratorStepper* GetStepper() const override; 0188 G4MagIntegratorStepper* GetStepper() override; 0189 0190 /** 0191 * Writes out to stream the parameters/state of the driver. 0192 */ 0193 void StreamInfo( std::ostream& os ) const override; 0194 0195 private: 0196 0197 G4int GetNumberOfVarialbles() const; 0198 0199 G4double fMinimumStep; 0200 G4double fVerbosity; 0201 0202 G4ModifiedMidpoint fMidpointMethod; 0203 G4BulirschStoer* bulirschStoer; 0204 0205 G4double yIn[G4FieldTrack::ncompSVEC], 0206 yMid[G4FieldTrack::ncompSVEC], 0207 yMid2[G4FieldTrack::ncompSVEC], 0208 yOut[G4FieldTrack::ncompSVEC], 0209 yOut2[G4FieldTrack::ncompSVEC], 0210 yError[G4FieldTrack::ncompSVEC]; 0211 0212 0213 G4double dydxCurrent[G4FieldTrack::ncompSVEC]; 0214 G4double yCurrent[G4FieldTrack::ncompSVEC]; 0215 0216 G4double derivs[2][6][G4FieldTrack::ncompSVEC]; 0217 0218 const G4int interval_sequence[2]; 0219 0220 using ChordFinderDelegate = 0221 G4ChordFinderDelegate<G4IntegrationDriver<G4BulirschStoer>>; 0222 }; 0223 0224 #include "G4BulirschStoerDriver.icc" 0225 0226 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|