|
|
|||
File indexing completed on 2026-09-09 09:09:59
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 // G4TsitourasRK45 0027 // 0028 // Class description: 0029 // 0030 // Tsitouras - 5(4) RK stepper (non-FSAL version) 0031 // Implements RK tableau from 'Table 1' of: 0032 // C. Tsitouras, "Runge-Kutta pairs of order 5(4) satisfying only 0033 // the first column simplifying assumption" 0034 // Computers & Mathematics with Applications, 0035 // vol. 62, no. 2, pp. 770-775, 2011. 0036 0037 // Author: Somnath Banerjee (CERN, Google Summer of Code 2015), 11.06.2015 0038 // Supervision: John Apostolakis (CERN) 0039 // -------------------------------------------------------------------- 0040 #ifndef TSITOURAS_RK45_HH 0041 #define TSITOURAS_RK45_HH 0042 0043 #include "G4MagIntegratorStepper.hh" 0044 0045 /** 0046 * @brief G4TsitourasRK45 is an implementation of the 5(4) Runge-Kutta 0047 * stepper (non-FSAL version). 0048 */ 0049 0050 class G4TsitourasRK45 : public G4MagIntegratorStepper 0051 { 0052 public: 0053 0054 /** 0055 * Constructor for G4TsitourasRK45. 0056 * @param[in] EqRhs Pointer to the provided equation of motion. 0057 * @param[in] numberOfVariables The number of integration variables. 0058 * @param[in] primary Flag for initialisation of the auxiliary stepper. 0059 */ 0060 G4TsitourasRK45(G4EquationOfMotion* EqRhs, 0061 G4int numberOfVariables = 6, 0062 G4bool primary = true); 0063 /** 0064 * Destructor. 0065 */ 0066 ~G4TsitourasRK45() override; 0067 0068 /** 0069 * Copy constructor and assignment operator not allowed. 0070 */ 0071 G4TsitourasRK45(const G4TsitourasRK45&) = delete; 0072 G4TsitourasRK45& operator=(const G4TsitourasRK45&) = delete; 0073 0074 /** 0075 * The stepper for the Runge Kutta integration. 0076 * The stepsize is fixed, with the step size given by 'h'. 0077 * Integrates ODE starting values y[0 to 6]. 0078 * Outputs yout[] and its estimated error yerr[]. 0079 * @param[in] y Starting values array of integration variables. 0080 * @param[in] dydx Derivatives array. 0081 * @param[in] h The given step size. 0082 * @param[out] yout Integration output. 0083 * @param[out] yerr The estimated error. 0084 */ 0085 void Stepper( const G4double y[], 0086 const G4double dydx[], 0087 G4double h, 0088 G4double yout[], 0089 G4double yerr[] ) override; 0090 0091 /** 0092 * Setup all coefficients for interpolation. 0093 */ 0094 void SetupInterpolation( /* const G4double yInput[], 0095 const G4double dydx[], 0096 const G4double Step */ ); 0097 0098 /** 0099 * Calculates the output at the tau fraction of step. 0100 * @param[in] yInput Starting values array of integration variables. 0101 * @param[in] dydx Derivatives array. 0102 * @param[in] Step The given step size. 0103 * @param[out] yOut Interpolation output. 0104 * @param[in] tau The tau fraction of the step. 0105 */ 0106 void Interpolate( const G4double yInput[], 0107 const G4double dydx[], 0108 const G4double Step, 0109 G4double yOut[], 0110 G4double tau ); 0111 void interpolate( const G4double yInput[], 0112 const G4double dydx[], 0113 G4double yOut[], 0114 G4double Step, 0115 G4double tau); 0116 0117 /** 0118 * Returns the distance from chord line. 0119 */ 0120 G4double DistChord() const override; 0121 0122 /** 0123 * Returns the order, 4, of integration. 0124 */ 0125 inline G4int IntegratorOrder() const override { return 4; } 0126 0127 /** 0128 * Returns the stepper type-ID, "kTsitourasRK45". 0129 */ 0130 inline G4StepperType StepperType() const override { return kTsitourasRK45; } 0131 0132 private : 0133 0134 G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *ak8, *yTemp, *yIn; 0135 0136 G4double fLastStepLength = 0.0; 0137 G4double *fLastInitialVector, *fLastFinalVector, 0138 *fLastDyDx, *fMidVector, *fMidError; 0139 // For DistChord calculations 0140 0141 G4TsitourasRK45* fAuxStepper = nullptr; 0142 }; 0143 0144 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|