Geant4 11.1.1
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"
50
52{
53 public:
54
55 virtual ~G4VIntegrationDriver() = default;
56
58 G4double hstep,
59 G4double eps,
60 G4double chordDistance) = 0;
61
63 G4double hstep,
64 G4double eps, // Requested y_err/hstep
65 G4double hinitial = 0 ) = 0;
66
67 virtual void SetEquationOfMotion(G4EquationOfMotion* equation) = 0;
69
70 virtual void RenewStepperAndAdjust(G4MagIntegratorStepper* pItsStepper);
71 // Method for compatibility -- relevant only for G4MagIntegratorDriver
72
73 virtual void SetVerboseLevel(G4int level) = 0;
74 virtual G4int GetVerboseLevel() const = 0;
75
76 virtual void OnComputeStep() = 0;
77
78 virtual void OnStartTracking() = 0;
79
80 public: // without description
81
82 //[[deprecated("will be removed")]]
83 virtual G4bool QuickAdvance(G4FieldTrack& /*track*/, // INOUT
84 const G4double /*dydx*/[],
85 G4double /*hstep*/,
86 G4double& /*dchord_step*/,
87 G4double& /*dyerr*/) { return false; }
88
89 //[[deprecated("will be removed")]]
90 virtual void GetDerivatives(const G4FieldTrack& track,
91 G4double dydx[]) const = 0;
92
93 //[[deprecated("will be removed")]]
94 virtual void GetDerivatives(const G4FieldTrack& track,
95 G4double dydx[],
96 G4double field[]) const = 0;
97
98 //[[deprecated("use GetEquationOfMotion() instead of GetStepper()->GetEquationOfMotion()")]]
99 virtual const G4MagIntegratorStepper* GetStepper() const = 0;
101
102 //[[deprecated("will be removed")]]
103 virtual G4double ComputeNewStepSize(G4double errMaxNorm, // normalised error
104 G4double hstepCurrent) = 0;
105 // Taking the last step's normalised error, calculate
106 // a step size for the next step.
107 // - Can limit the next step's size within a factor of the current one.
108
109 virtual G4bool DoesReIntegrate() const = 0;
110 // Whether the driver implementates re-integration
111 // - original Integration driver will re-start and re-calculate interval => yes
112 // - Interpolation Driver does not recalculate (it interpolates)
113 // Basically answer: does this driver *Recalculate* when AccurateAdvance is called ?
114
115 virtual void StreamInfo( std::ostream& os ) const = 0;
116 // Write out the parameters / state of the driver
117
118 friend std::ostream& operator<<( std::ostream& os, const G4VIntegrationDriver& id);
119
120 protected:
121
122 static constexpr G4double max_stepping_increase = 5;
123 static constexpr G4double max_stepping_decrease = 0.1;
124};
125
126#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual ~G4VIntegrationDriver()=default
virtual void OnComputeStep()=0
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 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)