Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BulirschStoerDriver.hh
Go to the documentation of this file.
1// ********************************************************************
2// * License and Disclaimer *
3// * *
4// * The Geant4 software is copyright of the Copyright Holders of *
5// * the Geant4 Collaboration. It is provided under the terms and *
6// * conditions of the Geant4 Software License, included in the file *
7// * LICENSE and available at http://cern.ch/geant4/license . These *
8// * include a list of copyright holders. *
9// * *
10// * Neither the authors of this software system, nor their employing *
11// * institutes,nor the agencies providing financial support for this *
12// * work make any representation or warranty, express or implied, *
13// * regarding this software system or assume any liability for its *
14// * use. Please see the license in the file LICENSE and URL above *
15// * for the full disclaimer and the limitation of liability. *
16// * *
17// * This code implementation is the result of the scientific and *
18// * technical work of the GEANT4 collaboration. *
19// * By using, copying, modifying or distributing the software (or *
20// * any work based on the software) you agree to acknowledge its *
21// * use in resulting scientific publications, and indicate your *
22// * acceptance of all terms of the Geant4 Software license. *
23// ********************************************************************
24//
25// G4BulirschStoer driver
26//
27// Class description:
28//
29// G4IntegrationDriver<G4BulirschStoer> is a concrete driver class using
30// Bulirsch-Stoer method to integrate the equation of motion.
31
32// Author: Dmitry Sorokin (CERN, Google Summer of Code 2016), 13.02.2018
33// Supervision: John Apostolakis (CERN)
34// --------------------------------------------------------------------
35#ifndef G4BULIRSCH_STOER_DRIVER_HH
36#define G4BULIRSCH_STOER_DRIVER_HH
37
39#include "G4BulirschStoer.hh"
41
42/**
43 * @brief G4IntegrationDriver<G4BulirschStoer> is a concrete driver class
44 * using the Bulirsch-Stoer method to integrate the equation of motion.
45 */
46
47template <>
50 public G4ChordFinderDelegate<G4IntegrationDriver<G4BulirschStoer>>
51{
52 public:
53
54 /**
55 * Constructor for the concrete G4IntegrationDriver.
56 * @param[in] hminimum The minumum allowed step..
57 * @param[in] Boris Pointer to the Bulirsch-Stoer motion algorithm.
58 * @param[in] numberOfComponents The number of integration variables.
59 * @param[in] verbosity Flag for verbosity.
60 */
62 G4BulirschStoer* stepper,
63 G4int numberOfComponents = 6,
64 G4int statisticsVerbosity = 1);
65
66 /**
67 * Default Destructor.
68 */
70
71 /**
72 * Copy constructor and assignment operator not allowed.
73 */
76
77 /**
78 * Computes the step to take, based on chord limits.
79 * @param[in,out] track The current track in field.
80 * @param[in] hstep Proposed step length.
81 * @param[in] eps Requested accuracy, y_err/hstep.
82 * @param[in] chordDistance Maximum sagitta distance.
83 * @returns The length of step taken.
84 */
86 G4double hstep,
87 G4double eps,
88 G4double chordDistance) override;
89
90 /**
91 * Dispatch interface method for initialisation/reset of driver.
92 */
93 void OnStartTracking() override;
94
95 /**
96 * Dispatch interface method for computing step. Does nothing here.
97 */
98 void OnComputeStep(const G4FieldTrack* track = nullptr) override;
99
100 /**
101 * The driver does not implement re-integration. Returns false.
102 */
103 G4bool DoesReIntegrate() const override;
104
105 /**
106 * Advances integration accurately by relative accuracy better than 'eps'.
107 * @param[in,out] track The current track in field.
108 * @param[in] stepLen Proposed step length.
109 * @param[in] eps Requested accuracy, y_err/hstep.
110 * @param[in] beginStep Initial minimum integration step.
111 * @returns true if integration succeeds.
112 */
114 G4double stepLen,
115 G4double eps,
116 G4double beginStep = 0) override;
117
118 /**
119 * Attempts one integration step, and returns estimated error 'dyerr'.
120 * It does not ensure accuracy.
121 * @param[in,out] y_val The current track in field.
122 * @param[in] dydx dydx array.
123 * @param[in] hstep Proposed step length.
124 * @param[out] missDist Estimated sagitta distance.
125 * @param[out] dyerr Estimated error.
126 * @returns true if integration succeeds.
127 */
129 const G4double dydx[],
130 G4double hstep,
131 G4double& missDist,
132 G4double& dyerr) override;
133
134 /**
135 * Takes one Step that is as large as possible while satisfying the
136 * accuracy criterion.
137 * @param[in,out] y The current track state, y.
138 * @param[in] dydx dydx array.
139 * @param[in,out] curveLength Step start, x.
140 * @param[in] htry Step to attempt.
141 * @param[in] eps The relative accuracy.
142 * @param[out] hdid Step achieved.
143 * @param[out] hnext Proposed next step.
144 */
146 const G4double dydx[],
147 G4double& curveLength,
148 G4double htry,
149 G4double eps,
150 G4double& hdid,
151 G4double& hnext);
152
153 /**
154 * Getters for derivatives.
155 */
156 void GetDerivatives( const G4FieldTrack& track,
157 G4double dydx[]) const override;
158 void GetDerivatives( const G4FieldTrack& track,
159 G4double dydx[],
160 G4double field[]) const override;
161
162 /**
163 * Setter and getter for verbosity.
164 */
165 void SetVerboseLevel(G4int level) override;
166 G4int GetVerboseLevel() const override;
167
168 /**
169 * Computes the new step size .
170 * @param[in] errMaxNorm The normalised error.
171 * @param[in] hstepCurrent The current step size.
172 * @returns The new step size.
173 */
175 G4double hstepCurrent) override;
176
177 /**
178 * Getters and setter for the equation of motion.
179 */
182 void SetEquationOfMotion(G4EquationOfMotion* equation) override;
183
184 /**
185 * Getters for the stepper.
186 */
187 const G4MagIntegratorStepper* GetStepper() const override;
189
190 /**
191 * Writes out to stream the parameters/state of the driver.
192 */
193 void StreamInfo( std::ostream& os ) const override;
194
195 private:
196
197 G4int GetNumberOfVarialbles() const;
198
199 G4double fMinimumStep;
200 G4double fVerbosity;
201
202 G4ModifiedMidpoint fMidpointMethod;
203 G4BulirschStoer* bulirschStoer;
204
211
212
215
216 G4double derivs[2][6][G4FieldTrack::ncompSVEC];
217
218 const G4int interval_sequence[2];
219
220 using ChordFinderDelegate =
222};
223
224#include "G4BulirschStoerDriver.icc"
225
226#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4BulirschStoer is a controlled driver that adjusts both step size and order of the method....
G4ChordFinderDelegate is a templated class for a common algorithm of finding step size with distance ...
G4EquationOfMotion is the abstract base class for the right hand size of the equation of motion of a ...
G4FieldTrack defines a data structure bringing together a magnetic track's state (position,...
void OneGoodStep(G4double y[], const G4double dydx[], G4double &curveLength, G4double htry, G4double eps, G4double &hdid, G4double &hnext)
G4IntegrationDriver(const G4IntegrationDriver &)=delete
G4double ComputeNewStepSize(G4double errMaxNorm, G4double hstepCurrent) override
G4bool AccurateAdvance(G4FieldTrack &track, G4double stepLen, G4double eps, G4double beginStep=0) override
const G4EquationOfMotion * GetEquationOfMotion() const
void SetEquationOfMotion(G4EquationOfMotion *equation) override
void GetDerivatives(const G4FieldTrack &track, G4double dydx[]) const override
void GetDerivatives(const G4FieldTrack &track, G4double dydx[], G4double field[]) const override
G4IntegrationDriver & operator=(const G4IntegrationDriver &)=delete
void SetVerboseLevel(G4int level) override
G4int GetVerboseLevel() const override
const G4MagIntegratorStepper * GetStepper() const override
G4IntegrationDriver(G4double hminimum, G4BulirschStoer *stepper, G4int numberOfComponents=6, G4int statisticsVerbosity=1)
G4bool DoesReIntegrate() const override
void StreamInfo(std::ostream &os) const override
void OnComputeStep(const G4FieldTrack *track=nullptr) override
G4bool QuickAdvance(G4FieldTrack &y_val, const G4double dydx[], G4double hstep, G4double &missDist, G4double &dyerr) override
G4EquationOfMotion * GetEquationOfMotion() override
G4MagIntegratorStepper * GetStepper() override
G4double AdvanceChordLimited(G4FieldTrack &track, G4double hstep, G4double eps, G4double chordDistance) override
G4MagIntegratorStepper is an abstract base class for integrator of particle's equation of motion,...
G4ModifiedMidpoint implements a midpoint method adapted from Boost odeint.