|
|
|||
File indexing completed on 2026-08-24 09:10:40
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 // G4DormandPrinceRK56 0027 // 0028 // Class description: 0029 // 0030 // Dormand-Prince RK 6(5) non-FSAL method 0031 0032 // Author: Somnath Banerjee (CERN, Google Summer of Code 2015), 26.06.2015 0033 // Supervision: John Apostolakis (CERN) 0034 // -------------------------------------------------------------------- 0035 #ifndef G4DORMAND_PRINCE_RK56_HH 0036 #define G4DORMAND_PRINCE_RK56_HH 0037 0038 #include "G4MagIntegratorStepper.hh" 0039 0040 /** 0041 * @brief G4DormandPrinceRK56 implements the 6(5) embedded Runge-Kutta 0042 * non-FSAL method. 0043 */ 0044 0045 class G4DormandPrinceRK56 : public G4MagIntegratorStepper 0046 { 0047 public: 0048 0049 /** 0050 * Constructor for G4DormandPrinceRK56. 0051 * @param[in] EqRhs Pointer to the provided equation of motion. 0052 * @param[in] numberOfVariables The number of integration variables. 0053 * @param[in] primary Flag for initialisation of the auxiliary stepper. 0054 */ 0055 G4DormandPrinceRK56( G4EquationOfMotion* EqRhs, 0056 G4int numberOfVariables = 6, 0057 G4bool primary = true ) ; 0058 0059 /** 0060 * Destructor. 0061 */ 0062 ~G4DormandPrinceRK56() override ; 0063 0064 /** 0065 * Copy constructor and assignment operator not allowed. 0066 */ 0067 G4DormandPrinceRK56(const G4DormandPrinceRK56&) = delete; 0068 G4DormandPrinceRK56& operator=(const G4DormandPrinceRK56&) = delete; 0069 0070 /** 0071 * The stepper for the Runge Kutta integration. 0072 * The stepsize is fixed, with the step size given by 'h'. 0073 * Integrates ODE starting values y[0 to 6]. 0074 * Outputs yout[] and its estimated error yerr[]. 0075 * @param[in] y Starting values array of integration variables. 0076 * @param[in] dydx Derivatives array. 0077 * @param[in] h The given step size. 0078 * @param[out] yout Integration output. 0079 * @param[out] yerr The estimated error. 0080 */ 0081 void Stepper( const G4double y[], 0082 const G4double dydx[], 0083 G4double h, 0084 G4double yout[], 0085 G4double yerr[] ) override ; 0086 0087 /** 0088 * Returns the distance from chord line. 0089 */ 0090 G4double DistChord() const override; 0091 0092 /** 0093 * Returns the order, 5, of integration. 0094 */ 0095 inline G4int IntegratorOrder() const override { return 5; } 0096 0097 /** 0098 * Returns the stepper type-ID, "kDormandPrinceRK56". 0099 */ 0100 inline G4StepperType StepperType() const override { return kDormandPrinceRK56; } 0101 0102 /** 0103 * Prepares the interpolant and calculates the extra stages. 0104 * Fifth order interpolant with one extra function evaluation per step. 0105 */ 0106 void SetupInterpolate_low( const G4double yInput[], 0107 const G4double dydx[], 0108 const G4double Step ); 0109 0110 /** 0111 * Wrappers for SetupInterpolate_low() above. 0112 */ 0113 inline void SetupInterpolate( const G4double yInput[], 0114 const G4double dydx[], 0115 const G4double Step ) 0116 { 0117 SetupInterpolate_low( yInput, dydx, Step); 0118 } 0119 inline void SetupInterpolation() 0120 { 0121 SetupInterpolate( fLastInitialVector, fLastDyDx, fLastStepLength); 0122 } 0123 0124 /** 0125 * Calculates the output at the tau fraction of Step. 0126 */ 0127 void Interpolate_low( const G4double yInput[], 0128 const G4double dydx[], 0129 const G4double Step, 0130 G4double yOut[], 0131 G4double tau ); 0132 0133 /** 0134 * Wrappers for Interpolate_low() above. 0135 */ 0136 inline void Interpolate( const G4double yInput[], 0137 const G4double dydx[], 0138 const G4double Step, 0139 G4double yOut[], 0140 G4double tau ) 0141 { 0142 Interpolate_low( yInput, dydx, Step, yOut, tau); 0143 } 0144 inline void Interpolate( G4double tau, G4double yOut[]) 0145 { 0146 Interpolate( fLastInitialVector, fLastDyDx, fLastStepLength, yOut, tau ); 0147 } 0148 0149 /** 0150 * Prepares the interpolant and calculates the extra stages. 0151 * Sixth order interpolant with 3 additional stages per step. 0152 */ 0153 void SetupInterpolate_high( const G4double yInput[], 0154 const G4double dydx[], 0155 const G4double Step ); 0156 0157 /** 0158 * Calculates the output at the tau fraction of Step, using 0159 * the polynomial coefficients and the respective stages. 0160 */ 0161 void Interpolate_high( const G4double yInput[], 0162 const G4double dydx[], 0163 const G4double Step, 0164 G4double yOut[], 0165 G4double tau ); 0166 0167 private: 0168 0169 /** For storing intermediate 'k' values in stepper. */ 0170 G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *ak8, *ak9; 0171 0172 /** For the additional stages of Interpolant. */ 0173 G4double *ak10_low, *ak10, *ak11, * ak12; 0174 0175 G4double *yTemp, *yIn; 0176 0177 G4double fLastStepLength = -1.0; 0178 0179 /** For DistChord() calculations. */ 0180 G4double *fLastInitialVector, *fLastFinalVector, 0181 *fLastDyDx, *fMidVector, *fMidError; 0182 0183 G4DormandPrinceRK56* fAuxStepper = nullptr; 0184 }; 0185 0186 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|