Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:10

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 // G4DormandPrince745
0027 //
0028 // Class desription:
0029 //
0030 //  An implementation of the 5th order embedded RK method from the paper:
0031 //  J. R. Dormand and P. J. Prince, "A family of embedded Runge-Kutta formulae"
0032 //  Journal of computational and applied Math., vol.6, no.1, pp.19-26, 1980.
0033 //
0034 //  DormandPrince7 - 5(4) embedded RK method
0035 //
0036 
0037 // Created: Somnath Banerjee, Google Summer of Code 2015, 25 May 2015
0038 // Supervision: John Apostolakis, CERN
0039 // --------------------------------------------------------------------
0040 #ifndef G4DORMAND_PRINCE_745_HH
0041 #define G4DORMAND_PRINCE_745_HH
0042 
0043 #include "G4MagIntegratorStepper.hh"
0044 #include "G4FieldUtils.hh"
0045 
0046 class G4DormandPrince745 : public G4MagIntegratorStepper
0047 {
0048   public:
0049 
0050     G4DormandPrince745(G4EquationOfMotion* equation,
0051                        G4int numberOfVariables = 6);
0052 
0053     void Stepper(const G4double yInput[],
0054                  const G4double dydx[],
0055                        G4double hstep,
0056                        G4double yOutput[],
0057                        G4double yError[]) override;
0058 
0059     void Stepper(const G4double yInput[],
0060                  const G4double dydx[],
0061                        G4double hstep,
0062                        G4double yOutput[],
0063                        G4double yError[],
0064                        G4double dydxOutput[]);
0065 
0066     inline void SetupInterpolation() {}
0067 
0068     inline void Interpolate(G4double tau, G4double yOut[]) const
0069     {
0070       Interpolate4thOrder(yOut, tau);
0071     }
0072       // For calculating the output at the tau fraction of Step
0073 
0074     G4double DistChord() const override;
0075 
0076     G4int IntegratorOrder() const override { return 4; }
0077 
0078     const G4String& StepperType() const        { return gStepperType; }
0079     const G4String& StepperDescription() const { return gStepperDescription; }
0080    
0081     const field_utils::State& GetYOut() const { return fyOut; }
0082 
0083     void Interpolate4thOrder(G4double yOut[], G4double tau) const;
0084 
0085     void SetupInterpolation5thOrder();
0086     void Interpolate5thOrder(G4double yOut[], G4double tau) const;
0087 
0088     G4EquationOfMotion* GetSpecificEquation() { return GetEquationOfMotion(); }
0089 
0090   private:
0091 
0092     static const G4String gStepperType;
0093     static const G4String gStepperDescription;
0094       // Name and description of this steppers
0095       // plus details of its implementation
0096 
0097     field_utils::State ak2, ak3, ak4, ak5, ak6, ak7, ak8, ak9;
0098     field_utils::State fyIn, fyOut, fdydxIn;
0099 
0100     G4double fLastStepLength = -1.0;
0101 };
0102 
0103 #endif