00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4CashKarpRKF45.hh 69786 2013-05-15 09:38:51Z gcosmo $ 00028 // 00029 // 00030 // class G4CashKarpRKF45 00031 // 00032 // Class description: 00033 // 00034 // The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth 00035 // order method (giving fifth-order accuracy) for the solution of an ODE. 00036 // Two different fourth order estimates are calculated; their difference 00037 // gives an error estimate. [ref. Numerical Recipes in C, 2nd Edition] 00038 // It is used to integrate the equations of the motion of a particle 00039 // in a magnetic field. 00040 00041 // History: 00042 // - Created. J.Apostolakis, V.Grichine - 30.1.97 00043 // ------------------------------------------------------------------- 00044 00045 #ifndef G4CashKARP_RKF45 00046 #define G4CashKARP_RKF45 00047 00048 #include "G4MagIntegratorStepper.hh" 00049 00050 class G4CashKarpRKF45 : public G4MagIntegratorStepper 00051 { 00052 00053 public: // with description 00054 00055 G4CashKarpRKF45( G4EquationOfMotion *EqRhs, 00056 G4int numberOfVariables = 6, 00057 G4bool primary= true ) ; 00058 ~G4CashKarpRKF45() ; 00059 00060 void Stepper( const G4double y[], 00061 const G4double dydx[], 00062 G4double h, 00063 G4double yout[], 00064 G4double yerr[] ) ; 00065 00066 public: // without description 00067 00068 G4double DistChord() const; 00069 G4int IntegratorOrder() const { return 4; } 00070 00071 private: 00072 00073 void StepWithEst( const G4double yIn[], 00074 const G4double dydx[], 00075 G4double Step, 00076 G4double yOut[], 00077 G4double& alpha2, 00078 G4double& beta2, 00079 const G4double B1[], 00080 G4double B2[] ); 00081 // No longer used. Obsolete. 00082 00083 G4CashKarpRKF45(const G4CashKarpRKF45&); 00084 G4CashKarpRKF45& operator=(const G4CashKarpRKF45&); 00085 // Private copy constructor and assignment operator. 00086 00087 private: 00088 00089 G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *yTemp, *yIn; 00090 // scratch space 00091 00092 G4double fLastStepLength; 00093 G4double *fLastInitialVector, *fLastFinalVector, 00094 *fLastDyDx, *fMidVector, *fMidError; 00095 // for DistChord calculations 00096 00097 G4CashKarpRKF45* fAuxStepper; 00098 00099 }; 00100 00101 #endif /* G4CashKARP_RKF45 */