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: G4ClassicalRK4.hh 69786 2013-05-15 09:38:51Z gcosmo $ 00028 // 00029 // 00030 // class G4ClassicalRK4 00031 // 00032 // Class description: 00033 // 00034 // Integrate the equations of the motion of a particle in a magnetic field 00035 // using the classical 4th Runge-Kutta method. 00036 00037 // History: 00038 // - Created: J.Apostolakis, V.Grichine - 30.1.97 00039 // - Moved into G4MagErrorStepper: W.Wander <wwc@mit.edu> - 12/09/97 00040 // ------------------------------------------------------------------- 00041 00042 #include "G4MagErrorStepper.hh" 00043 00044 class G4ClassicalRK4 : public G4MagErrorStepper 00045 { 00046 public: // with description 00047 00048 G4ClassicalRK4(G4EquationOfMotion *EquationMotion, G4int numberOfVariables = 6) ; 00049 00050 ~G4ClassicalRK4() ; 00051 00052 // A stepper that does not know about errors. 00053 // It is used by the MagErrorStepper stepper. 00054 00055 void DumbStepper( const G4double yIn[], 00056 const G4double dydx[], 00057 G4double h, 00058 G4double yOut[] ) ; 00059 // Given values for the variables y[0,..,n-1] and their derivatives 00060 // dydx[0,...,n-1] known at x, use the classical 4th Runge-Kutta 00061 // method to advance the solution over an interval h and return the 00062 // incremented variables as yout[0,...,n-1], which not be a distinct 00063 // array from y. The user supplies the routine RightHandSide(x,y,dydx), 00064 // which returns derivatives dydx at x. The source is routine rk4 from 00065 // NRC p. 712-713 . 00066 00067 public: // without description 00068 00069 G4int IntegratorOrder() const { return 4; } 00070 00071 private: 00072 00073 void StepWithEst( const G4double yIn[], 00074 const G4double dydx[], 00075 G4double h, 00076 G4double yOut[], 00077 G4double& alpha2, 00078 G4double& beta2, 00079 const G4double B1[], 00080 G4double B2[] ); 00081 // No longer used. Obsolete. 00082 00083 G4ClassicalRK4(const G4ClassicalRK4&); 00084 G4ClassicalRK4& operator=(const G4ClassicalRK4&); 00085 // Private copy constructor and assignment operator. 00086 00087 private: 00088 00089 // G4int fNumberOfVariables ; // is set default to 6 in constructor 00090 00091 G4double *dydxm, *dydxt, *yt; // scratch space - not state 00092 };