Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4CashKarpRKF45
0027 //
0028 // Class description:
0029 //
0030 // The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
0031 // order method (giving fifth-order accuracy) for the solution of an ODE.
0032 // Two different fourth order estimates are calculated; their difference
0033 // gives an error estimate. [ref. Numerical Recipes in C, 2nd Edition]
0034 // It is used to integrate the equations of the motion of a particle 
0035 // in a magnetic field.
0036 
0037 // Authors: J.Apostolakis, V.Grichine - 30.01.1997
0038 // -------------------------------------------------------------------
0039 #ifndef G4CASHKARP_RKF45_HH
0040 #define G4CASHKARP_RKF45_HH
0041 
0042 #include "G4MagIntegratorStepper.hh"
0043 
0044 class G4CashKarpRKF45 : public G4MagIntegratorStepper
0045 {
0046   public:
0047 
0048     G4CashKarpRKF45( G4EquationOfMotion* EqRhs,
0049                      G4int numberOfVariables = 6,
0050                      G4bool primary = true ) ;
0051    ~G4CashKarpRKF45() override ;
0052 
0053     G4CashKarpRKF45(const G4CashKarpRKF45&) = delete;
0054     G4CashKarpRKF45& operator=(const G4CashKarpRKF45&) = delete;
0055       // Deleted copy constructor and assignment operator.
0056 
0057     void Stepper( const G4double y[],
0058                   const G4double dydx[],
0059                         G4double h,
0060                         G4double yout[],
0061                         G4double yerr[] ) override ;
0062 
0063     G4double  DistChord()   const override; 
0064     G4int IntegratorOrder() const override { return 4; }
0065 
0066   private:
0067 
0068     void StepWithEst( const G4double yIn[],
0069                       const G4double dydx[],
0070                             G4double Step,
0071                             G4double yOut[],
0072                             G4double& alpha2,
0073                             G4double& beta2,
0074                       const G4double B1[],
0075                             G4double B2[]    );  
0076       // No longer used. Obsolete.
0077 
0078   private:
0079 
0080    G4double *ak2, *ak3, *ak4, *ak5, *ak6, *yTemp, *yIn; // *ak7
0081       // scratch space
0082 
0083     G4double fLastStepLength = 0.0;
0084     G4double *fLastInitialVector, *fLastFinalVector,
0085              *fLastDyDx, *fMidVector, *fMidError;
0086       // for DistChord calculations
0087 
0088     G4CashKarpRKF45* fAuxStepper = nullptr;
0089 };
0090 
0091 #endif