Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-01 08:53:47

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 // G4DormandPrinceRK78
0027 //
0028 // Class description:
0029 //
0030 // Dormand-Prince 8(7)13M non-FSAL RK method, a 13 stage embedded
0031 // explicit Runge-Kutta method, using a pair of 7th and 8th order formulae.
0032 //
0033 // Paper proposing this RK scheme:
0034 // P.J. Prince, J.R. Dormand, "High order embedded Runge-Kutta formulae",
0035 // Journal of Computational and Applied Mathematics, Volume 7, Issue 1, 1981,
0036 // Pages 67-75, ISSN 0377-0427, DOI: 10.1016/0771-050X(81)90010-3
0037 
0038 // Author: Somnath Banerjee (CERN, Google Summer of Code 2015), 28.06.2015
0039 // Supervision: John Apostolakis (CERN)
0040 // --------------------------------------------------------------------
0041 #ifndef G4DORMAND_PRINCE_RK78_HH
0042 #define G4DORMAND_PRINCE_RK78_HH
0043 
0044 #include "G4MagIntegratorStepper.hh"
0045 
0046 /**
0047  * @brief G4DormandPrinceRK78 implements the Dormand-Prince 8(7)13M non-FSAL
0048  * Runge-Kutta method, a 13 stage embedded explicit Runge-Kutta method, using
0049  * a pair of 7th and 8th order formulae.
0050  */
0051 
0052 class G4DormandPrinceRK78 : public G4MagIntegratorStepper
0053 {
0054   public:
0055 
0056     /**
0057      * Constructor for G4DormandPrince745.
0058      *  @param[in] EqRhs Pointer to the provided equation of motion.
0059      *  @param[in] numberOfVariables The number of integration variables.
0060      *  @param[in] primary Flag for initialisation of the auxiliary stepper.
0061      */
0062     G4DormandPrinceRK78(G4EquationOfMotion* EqRhs,
0063                         G4int numberOfVariables = 6,
0064                         G4bool primary = true);
0065 
0066     /**
0067      * Destructor.
0068      */
0069     ~G4DormandPrinceRK78() override;
0070     
0071     /**
0072      * Copy constructor and assignment operator not allowed.
0073      */
0074     G4DormandPrinceRK78(const G4DormandPrinceRK78&) = delete;
0075     G4DormandPrinceRK78& operator=(const G4DormandPrinceRK78&) = delete;
0076 
0077     /**
0078      * The stepper for the Runge Kutta integration.
0079      * The stepsize is fixed, with the step size given by 'h'.
0080      * Integrates ODE starting values y[0 to 6].
0081      * Outputs yout[] and its estimated error yerr[].
0082      *  @param[in] y Starting values array of integration variables.
0083      *  @param[in] dydx Derivatives array.
0084      *  @param[in] h The given step size.
0085      *  @param[out] yout Integration output.
0086      *  @param[out] yerr The estimated error.
0087      */
0088     void Stepper( const G4double y[],
0089                   const G4double dydx[],
0090                         G4double h,
0091                         G4double yout[],
0092                         G4double yerr[]) override ;
0093 
0094     /**
0095      * Returns the distance from chord line.
0096      */
0097     G4double  DistChord() const override;
0098 
0099     /**
0100      * Returns the order, 7, of integration.
0101      */
0102     inline G4int IntegratorOrder() const override { return 7; }
0103 
0104     /**
0105      * Returns the stepper type-ID, "kDormandPrinceRK78".
0106      */
0107     inline G4StepperType StepperType() const override { return kDormandPrinceRK78; }
0108     
0109   private :  
0110     
0111     G4double *ak2,   *ak3,  *ak4,  *ak5,  *ak6,  *ak7, *ak8,
0112              *ak9,   *ak10, *ak11, *ak12, *ak13,
0113              *yTemp, *yIn;
0114 
0115     G4double fLastStepLength = -1.0;
0116 
0117     /** For DistChord() calculations. */
0118     G4double *fLastInitialVector, *fLastFinalVector,
0119              *fLastDyDx, *fMidVector, *fMidError;
0120 
0121     G4DormandPrinceRK78* fAuxStepper = nullptr;
0122 };
0123 
0124 #endif