Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ClassicalRK4.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4ClassicalRK4
27//
28// Class description:
29//
30// Integrate the equations of the motion of a particle in a magnetic field
31// using the classical 4th Runge-Kutta method.
32
33// Authors: J.Apostolakis, V.Grichine (CERN), 30.01.1997
34// -------------------------------------------------------------------
35#ifndef G4CLASSICALRK4_HH
36#define G4CLASSICALRK4_HH
37
38#include "G4MagErrorStepper.hh"
39
40/**
41 * @brief G4ClassicalRK4 integrates the equations of the motion of a particle
42 * in a magnetic field using the classical 4th Runge-Kutta method.
43 */
44
46{
47 public:
48
49 /**
50 * Constructor for G4ClassicalRK4.
51 * @param[in] EquationMotion Pointer to the provided equation of motion.
52 * @param[in] numberOfVariables The number of integration variables.
53 */
54 G4ClassicalRK4(G4EquationOfMotion* EquationMotion,
55 G4int numberOfVariables = 6) ;
56
57 /**
58 * Destructor.
59 */
60 ~G4ClassicalRK4() override ;
61
62 /**
63 * Copy constructor and assignment operator not allowed.
64 */
67
68 // A stepper that does not know about errors.
69 // It is used by the MagErrorStepper stepper.
70
71 /**
72 * Given values for the variables y[0,..,n-1] and their derivatives
73 * dydx[0,...,n-1] known at x, uses the classical 4th Runge-Kutta
74 * method to advance the solution over an interval h and returns the
75 * incremented variables as yout[0,...,n-1]. The user supplies the
76 * function RightHandSide(x,y,dydx), which returns derivatives dydx at x.
77 * The source is routine rk4 from NRC p.712-713.
78 * @param[in] yIn Starting values array of integration variables.
79 * @param[in] dydx Derivatives array.
80 * @param[in] h The given step size.
81 * @param[out] yOut Integration output.
82 */
83 void DumbStepper( const G4double yIn[],
84 const G4double dydx[],
85 G4double h,
86 G4double yOut[] ) override ;
87
88 /**
89 * Returns the order, 4, of integration.
90 */
91 G4int IntegratorOrder() const override { return 4; }
92
93 /**
94 * Returns the stepper type-ID, "kClassicalRK4".
95 */
96 G4StepperType StepperType() const override { return kClassicalRK4; }
97
98 private:
99
100 G4double *dydxm, *dydxt, *yt; // scratch space - not state
101};
102
103#endif
G4StepperType
G4StepperType defines the available integrator of particle's equation of motion in Geant4.
@ kClassicalRK4
G4ClassicalRK4.
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
void DumbStepper(const G4double yIn[], const G4double dydx[], G4double h, G4double yOut[]) override
G4StepperType StepperType() const override
G4ClassicalRK4(G4EquationOfMotion *EquationMotion, G4int numberOfVariables=6)
G4ClassicalRK4(const G4ClassicalRK4 &)=delete
G4int IntegratorOrder() const override
G4ClassicalRK4 & operator=(const G4ClassicalRK4 &)=delete
~G4ClassicalRK4() override
G4EquationOfMotion is the abstract base class for the right hand size of the equation of motion of a ...
G4MagErrorStepper(G4EquationOfMotion *EqRhs, G4int numberOfVariables, G4int numStateVariables=12)