File indexing completed on 2025-01-18 09:59:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #ifndef G4RKINTEGRATIONDRIVER_HH
0036 #define G4RKINTEGRATIONDRIVER_HH
0037
0038 #include "G4VIntegrationDriver.hh"
0039
0040 template <class T>
0041 class G4RKIntegrationDriver : public G4VIntegrationDriver
0042 {
0043 public:
0044
0045 G4RKIntegrationDriver(T* stepper);
0046
0047 G4RKIntegrationDriver(const G4RKIntegrationDriver&) = delete;
0048 G4RKIntegrationDriver& operator=(const G4RKIntegrationDriver&) = delete;
0049
0050 void GetDerivatives(const G4FieldTrack& track,
0051 G4double dydx[]) const override;
0052
0053 void GetDerivatives(const G4FieldTrack& track,
0054 G4double dydx[],
0055 G4double field[]) const override;
0056
0057 G4double ComputeNewStepSize(G4double errMaxNorm,
0058 G4double hstepCurrent) final;
0059
0060
0061
0062
0063 G4EquationOfMotion* GetEquationOfMotion() override;
0064 void SetEquationOfMotion(G4EquationOfMotion* equation) override;
0065
0066 const T* GetStepper() const override;
0067 T* GetStepper() override;
0068
0069 void StreamInfo( std::ostream& os ) const override;
0070
0071
0072 G4double GetSafety() const;
0073 G4double GetPshrnk() const;
0074 G4double GetPgrow() const;
0075
0076 void RenewStepperAndAdjust(G4MagIntegratorStepper* stepper) override;
0077
0078 void ReSetParameters(G4double safety = 0.9);
0079 void SetSafety(G4double valS);
0080
0081
0082
0083
0084 G4int GetMaxNoSteps() const;
0085 void SetMaxNoSteps(G4int val);
0086
0087
0088
0089
0090 G4double GetSmallestFraction() const;
0091 void SetSmallestFraction(G4double val);
0092
0093 protected:
0094
0095 G4double ShrinkStepSize(G4double h, G4double error) const;
0096 G4double GrowStepSize(G4double h, G4double error) const;
0097
0098 G4double ShrinkStepSize2(G4double h, G4double error2) const;
0099 G4double GrowStepSize2(G4double h, G4double error2) const;
0100
0101 void UpdateErrorConstraints();
0102
0103 private:
0104
0105 inline void RenewStepperAndAdjustImpl(T* stepper);
0106
0107 G4int fMaxNoSteps;
0108
0109 G4int fMaxStepBase;
0110
0111
0112
0113
0114
0115 G4double safety;
0116 G4double pshrnk;
0117 G4double pgrow;
0118
0119
0120
0121 G4double errorConstraintShrink;
0122 G4double errorConstraintGrow;
0123
0124 T* pIntStepper = nullptr;
0125 };
0126
0127 #include "G4RKIntegrationDriver.icc"
0128
0129 #endif