Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:11: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 // G4ImplicitEuler
0027 //
0028 // Class description:
0029 //
0030 // Implicit Euler stepper for magnetic field:
0031 //      x_1 = x_0 + h/2 * ( dx(t_0,x_0) + dx(t_0+h,x_0+h*dx(t_0,x_0) ) )
0032 //
0033 // Second order solver.
0034 // Takes the current derivative and add it to the current position.
0035 // Takes the output and its derivative. Adds the mean of both
0036 // derivatives to form the final output.
0037 
0038 // Author: W.Wander (MIT), 12.09.1997
0039 // -------------------------------------------------------------------
0040 #ifndef G4IMPLICITEULER_HH
0041 #define G4IMPLICITEULER_HH
0042 
0043 #include "G4MagErrorStepper.hh"
0044 
0045 /**
0046  * @brief G4ImplicitEuler implements a Euler stepper for magnetic field
0047  * with 2nd order solver.
0048  */
0049 
0050 class G4ImplicitEuler : public G4MagErrorStepper
0051 {
0052   public:
0053 
0054     /**
0055      * Constructor for G4HelixSimpleRunge.
0056      *  @param[in] EqRhs Pointer to the provided equation of motion.
0057      *  @param[in] numberOfVariables The number of integration variables.
0058      */
0059     G4ImplicitEuler(G4EquationOfMotion* EqRhs,
0060                     G4int numberOfVariables = 6);
0061 
0062     /**
0063      * Destructor.
0064      */
0065     ~G4ImplicitEuler() override;
0066 
0067     /**
0068      * The stepper function for the integration.
0069      *  @param[in] y Starting values array of integration variables.
0070      *  @param[in] dydx The derivates array.
0071      *  @param[in] h The given step size.
0072      *  @param[out] yout Integration output.
0073      */
0074     void DumbStepper( const G4double y[] ,
0075                       const G4double dydx[] ,
0076                             G4double h ,
0077                             G4double yout[] ) override;
0078 
0079     /**
0080      * Returns the order, 2, of integration.
0081      */
0082     inline G4int IntegratorOrder() const override { return 2; }
0083     /**
0084      * Returns the stepper type-ID, "kImplicitEuler".
0085      */
0086     inline G4StepperType StepperType() const override { return kImplicitEuler; }
0087 
0088   private:
0089 
0090     /** Temporaries, created to avoid new/delete on every call. */
0091     G4double* dydxTemp = nullptr;
0092     G4double* yTemp = nullptr;    
0093 };
0094 
0095 #endif