G4MagIntegratorStepper.hh

Go to the documentation of this file.
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 // $Id: G4MagIntegratorStepper.hh 69786 2013-05-15 09:38:51Z gcosmo $
00027 //
00028 //
00029 // class G4MagIntegratorStepper
00030 //
00031 // Class description:
00032 //
00033 // Abstract base class for integrator of particle's equation of motion,
00034 // used in tracking in space dependent magnetic field
00035 //
00036 //  A Stepper must integrate over                NumberOfVariables elements,
00037 //   and also copy (from input to output) any of NoStateVariables  
00038 //   not included in the NumberOfVariables.  
00039 // 
00040 //  So it is expected that NoStateVariables >= NumberOfVariables
00041 
00042 // History:
00043 // - 15.01.97  J. Apostolakis (J.Apostolakis@cern.ch)
00044 // --------------------------------------------------------------------
00045 
00046 #ifndef G4MAGIntegratorSTEPPER
00047 #define G4MAGIntegratorSTEPPER
00048 
00049 #include "G4Types.hh"
00050 #include "G4EquationOfMotion.hh"
00051 
00052 class G4MagIntegratorStepper
00053 {
00054   public:  // with description
00055 
00056      G4MagIntegratorStepper(G4EquationOfMotion *Equation, 
00057                             G4int              numIntegrationVariables,
00058                             G4int              numStateVariables=12);
00059      virtual ~G4MagIntegratorStepper();
00060        // Constructor and destructor. No actions.
00061 
00062      virtual  void  Stepper(  const G4double y[],
00063                               const G4double dydx[],
00064                                     G4double h,
00065                                     G4double yout[],
00066                                     G4double yerr[]  ) = 0 ;
00067        // The stepper for the Runge Kutta integration.
00068        // The stepsize is fixed, with the Step size given by h.
00069        // Integrates ODE starting values y[0 to 6].
00070        // Outputs yout[] and its estimated error yerr[].
00071 
00072      virtual  G4double  DistChord() const = 0; 
00073        // Estimate the maximum distance of a chord from the true path
00074        // over the segment last integrated.
00075 
00076      virtual void ComputeRightHandSide( const G4double y[], G4double dydx[] ); 
00077        // Must compute the RightHandSide as in the method below
00078        // Optionally can cache the input y[] and the dydx[] values computed.
00079 
00080      inline void NormaliseTangentVector( G4double vec[6] );
00081        // Simple utility function to (re)normalise 'unit velocity' vector.
00082 
00083      inline void NormalisePolarizationVector( G4double vec[12] );
00084        // Simple utility function to (re)normalise 'unit spin' vector.
00085 
00086      inline void RightHandSide( const double y[], double dydx[] );   
00087        // Utility method to supply the standard Evaluation of the
00088        // Right Hand side of the associated equation.
00089 
00090 
00091      inline G4int  GetNumberOfVariables() const;
00092        // Get the number of variables that the stepper will integrate over.
00093 
00094      // void   SetNumberOfVariables(G4int newNo);  // Dangerous & obsolete ...
00095 
00096      inline G4int  GetNumberOfStateVariables() const;
00097        // Get the number of variables of state variables (>= above, integration)
00098 
00099      virtual G4int IntegratorOrder() const = 0;
00100        // Returns the order of the integrator
00101        // i.e. its error behaviour is of the order O(h^order).
00102 
00103      inline G4EquationOfMotion *GetEquationOfMotion(); 
00104        // As some steppers (eg RKG3) require other methods of Eq_Rhs
00105        // this function allows for access to them.
00106      inline void SetEquationOfMotion(G4EquationOfMotion* newEquation); 
00107 
00108   private:
00109   
00110      G4MagIntegratorStepper(const G4MagIntegratorStepper&);
00111      G4MagIntegratorStepper& operator=(const G4MagIntegratorStepper&);
00112        // Private copy constructor and assignment operator.
00113 
00114   private:
00115 
00116      G4EquationOfMotion *fEquation_Rhs;
00117      const G4int  fNoIntegrationVariables;  // Number of Variables in integration
00118      const G4int  fNoStateVariables;        // Number required for FieldTrack
00119      // const G4int  fNumberOfVariables;
00120 };
00121 
00122 #include  "G4MagIntegratorStepper.icc"
00123 
00124 #endif  /* G4MAGIntegratorSTEPPER */

Generated on Mon May 27 17:48:50 2013 for Geant4 by  doxygen 1.4.7