Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VIntegrationDriver.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// G4VIntegrationDriver
27//
28// Class description:
29//
30// Abstract base class for 'driver' classes which are responsible for
31// undertaking integration of an state given an equation of motion and
32// within acceptable error bound(s).
33//
34// Different integration methods are meant to be provided via this
35// common interface, and can span the original type (explicit Runge Kutta
36// methods), enhanced RK methods and alternatives such as the
37// Bulirsch-Stoer and multi-step methods.
38//
39// The drivers' key mission is to insure that the error is below set values.
40
41// Author: Dmitry Sorokin, Google Summer of Code 2017
42// Supervision: John Apostolakis, CERN
43// --------------------------------------------------------------------
44#ifndef G4VINTEGRATION_DRIVER_HH
45#define G4VINTEGRATION_DRIVER_HH
46
47#include "G4Types.hh"
48#include "G4FieldTrack.hh"
49#include "G4EquationOfMotion.hh"
50
52
54{
55 public:
56
57 virtual ~G4VIntegrationDriver() = default;
58
60 G4double hstep,
61 G4double eps,
62 G4double chordDistance) = 0;
63
65 G4double hstep,
66 G4double eps, // Requested y_err/hstep
67 G4double hinitial = 0 ) = 0;
68
69 virtual void SetEquationOfMotion(G4EquationOfMotion* equation) = 0;
71
72 virtual void RenewStepperAndAdjust(G4MagIntegratorStepper* pItsStepper);
73 // Method for compatibility -- relevant only for G4MagIntegratorDriver
74
75 virtual void SetVerboseLevel(G4int level) = 0;
76 virtual G4int GetVerboseLevel() const = 0;
77
78 virtual void OnComputeStep(const G4FieldTrack* /*track*/ = nullptr) = 0;
79
80 virtual void OnStartTracking() = 0;
81
82 public: // without description
83
84 //[[deprecated("will be removed")]]
85 virtual G4bool QuickAdvance(G4FieldTrack& /*track*/, // INOUT
86 const G4double /*dydx*/[],
87 G4double /*hstep*/,
88 G4double& /*dchord_step*/,
89 G4double& /*dyerr*/) { return false; }
90
91 //[[deprecated("will be removed")]]
92 virtual void GetDerivatives(const G4FieldTrack& track,
93 G4double dydx[]) const = 0;
94
95 //[[deprecated("will be removed")]]
96 virtual void GetDerivatives(const G4FieldTrack& track,
97 G4double dydx[],
98 G4double field[]) const = 0;
99
100 //[[deprecated("use GetEquationOfMotion() instead of GetStepper()->GetEquationOfMotion()")]]
101 virtual const G4MagIntegratorStepper* GetStepper() const = 0;
103
104 //[[deprecated("will be removed")]]
105 virtual G4double ComputeNewStepSize(G4double errMaxNorm, // normalised error
106 G4double hstepCurrent) = 0;
107 // Taking the last step's normalised error, calculate
108 // a step size for the next step.
109 // - Can limit the next step's size within a factor of the current one.
110
111 virtual G4bool DoesReIntegrate() const = 0;
112 // Whether the driver implementates re-integration
113 // - original Integration driver will re-start and re-calculate interval => yes
114 // - Interpolation Driver does not recalculate (it interpolates)
115 // Basically answer: does this driver *Recalculate* when AccurateAdvance is called ?
116
117 virtual void StreamInfo( std::ostream& os ) const = 0;
118 // Write out the parameters / state of the driver
119
120 friend std::ostream& operator<<( std::ostream& os, const G4VIntegrationDriver& id);
121
122 protected:
123
124 static constexpr G4double max_stepping_increase = 5;
125 static constexpr G4double max_stepping_decrease = 0.1;
126};
127
128#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
virtual ~G4VIntegrationDriver()=default
virtual G4double AdvanceChordLimited(G4FieldTrack &track, G4double hstep, G4double eps, G4double chordDistance)=0
virtual void RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper)
static constexpr G4double max_stepping_decrease
virtual G4int GetVerboseLevel() const =0
virtual const G4MagIntegratorStepper * GetStepper() const =0
virtual G4EquationOfMotion * GetEquationOfMotion()=0
virtual G4double ComputeNewStepSize(G4double errMaxNorm, G4double hstepCurrent)=0
virtual G4bool DoesReIntegrate() const =0
virtual void SetVerboseLevel(G4int level)=0
virtual G4MagIntegratorStepper * GetStepper()=0
virtual void StreamInfo(std::ostream &os) const =0
virtual G4bool QuickAdvance(G4FieldTrack &, const G4double[], G4double, G4double &, G4double &)
virtual void SetEquationOfMotion(G4EquationOfMotion *equation)=0
virtual void GetDerivatives(const G4FieldTrack &track, G4double dydx[]) const =0
static constexpr G4double max_stepping_increase
virtual void OnComputeStep(const G4FieldTrack *=nullptr)=0
virtual void GetDerivatives(const G4FieldTrack &track, G4double dydx[], G4double field[]) const =0
virtual G4bool AccurateAdvance(G4FieldTrack &track, G4double hstep, G4double eps, G4double hinitial=0)=0
virtual void OnStartTracking()=0
friend std::ostream & operator<<(std::ostream &os, const G4VIntegrationDriver &id)