Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BFieldIntegrationDriver Class Reference

#include <G4BFieldIntegrationDriver.hh>

+ Inheritance diagram for G4BFieldIntegrationDriver:

Public Member Functions

 G4BFieldIntegrationDriver (std::unique_ptr< G4VIntegrationDriver > smallStepDriver, std::unique_ptr< G4VIntegrationDriver > largeStepDriver)
 
 G4BFieldIntegrationDriver (const G4BFieldIntegrationDriver &)=delete
 
const G4BFieldIntegrationDriveroperator= (const G4BFieldIntegrationDriver &)=delete
 
virtual G4double AdvanceChordLimited (G4FieldTrack &track, G4double hstep, G4double eps, G4double chordDistance) override
 
virtual G4bool AccurateAdvance (G4FieldTrack &track, G4double hstep, G4double eps, G4double hinitial=0) override
 
virtual G4bool DoesReIntegrate () const override
 
virtual void GetDerivatives (const G4FieldTrack &track, G4double dydx[]) const override
 
virtual void GetDerivatives (const G4FieldTrack &track, G4double dydx[], G4double field[]) const override
 
virtual void SetEquationOfMotion (G4EquationOfMotion *equation) override
 
virtual G4EquationOfMotionGetEquationOfMotion () override
 
virtual const G4MagIntegratorStepperGetStepper () const override
 
virtual G4MagIntegratorStepperGetStepper () override
 
virtual G4double ComputeNewStepSize (G4double errMaxNorm, G4double hstepCurrent) override
 
virtual void SetVerboseLevel (G4int level) override
 
virtual G4int GetVerboseLevel () const override
 
virtual void OnComputeStep () override
 
virtual void OnStartTracking () override
 
virtual void StreamInfo (std::ostream &os) const override
 
void PrintStatistics () const
 
- Public Member Functions inherited from G4VIntegrationDriver
virtual ~G4VIntegrationDriver ()=default
 
virtual G4double AdvanceChordLimited (G4FieldTrack &track, G4double hstep, G4double eps, G4double chordDistance)=0
 
virtual G4bool AccurateAdvance (G4FieldTrack &track, G4double hstep, G4double eps, G4double hinitial=0)=0
 
virtual void SetEquationOfMotion (G4EquationOfMotion *equation)=0
 
virtual G4EquationOfMotionGetEquationOfMotion ()=0
 
virtual void RenewStepperAndAdjust (G4MagIntegratorStepper *pItsStepper)
 
virtual void SetVerboseLevel (G4int level)=0
 
virtual G4int GetVerboseLevel () const =0
 
virtual void OnComputeStep ()=0
 
virtual void OnStartTracking ()=0
 
virtual G4bool QuickAdvance (G4FieldTrack &, const G4double[], G4double, G4double &, G4double &)
 
virtual void GetDerivatives (const G4FieldTrack &track, G4double dydx[]) const =0
 
virtual void GetDerivatives (const G4FieldTrack &track, G4double dydx[], G4double field[]) const =0
 
virtual const G4MagIntegratorStepperGetStepper () const =0
 
virtual G4MagIntegratorStepperGetStepper ()=0
 
virtual G4double ComputeNewStepSize (G4double errMaxNorm, G4double hstepCurrent)=0
 
virtual G4bool DoesReIntegrate () const =0
 
virtual void StreamInfo (std::ostream &os) const =0
 

Additional Inherited Members

- Static Protected Attributes inherited from G4VIntegrationDriver
static constexpr G4double max_stepping_increase = 5
 
static constexpr G4double max_stepping_decrease = 0.1
 

Detailed Description

Definition at line 42 of file G4BFieldIntegrationDriver.hh.

Constructor & Destructor Documentation

◆ G4BFieldIntegrationDriver() [1/2]

G4BFieldIntegrationDriver::G4BFieldIntegrationDriver ( std::unique_ptr< G4VIntegrationDriver smallStepDriver,
std::unique_ptr< G4VIntegrationDriver largeStepDriver 
)

Definition at line 62 of file G4BFieldIntegrationDriver.cc.

65 : fSmallStepDriver(std::move(smallStepDriver)),
66 fLargeStepDriver(std::move(largeStepDriver)),
67 fCurrDriver(fSmallStepDriver.get()),
68 fEquation(toMagneticEquation(fCurrDriver->GetEquationOfMotion()))
69{
70 if (fSmallStepDriver->GetEquationOfMotion()
71 != fLargeStepDriver->GetEquationOfMotion())
72 {
73 G4Exception("G4BFieldIntegrationDriver Constructor:",
74 "GeomField1001", FatalException, "different EoM");
75 }
76}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
virtual G4EquationOfMotion * GetEquationOfMotion()=0

◆ G4BFieldIntegrationDriver() [2/2]

G4BFieldIntegrationDriver::G4BFieldIntegrationDriver ( const G4BFieldIntegrationDriver )
delete

Member Function Documentation

◆ AccurateAdvance()

virtual G4bool G4BFieldIntegrationDriver::AccurateAdvance ( G4FieldTrack track,
G4double  hstep,
G4double  eps,
G4double  hinitial = 0 
)
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 58 of file G4BFieldIntegrationDriver.hh.

62 {
63 return fCurrDriver->AccurateAdvance(track, hstep, eps, hinitial);
64 }
virtual G4bool AccurateAdvance(G4FieldTrack &track, G4double hstep, G4double eps, G4double hinitial=0)=0

◆ AdvanceChordLimited()

G4double G4BFieldIntegrationDriver::AdvanceChordLimited ( G4FieldTrack track,
G4double  hstep,
G4double  eps,
G4double  chordDistance 
)
overridevirtual

Implements G4VIntegrationDriver.

Definition at line 78 of file G4BFieldIntegrationDriver.cc.

82{
83 const G4double radius = CurvatureRadius(yCurrent);
84
85 G4VIntegrationDriver* driver = nullptr;
86 if (chordDistance < 2 * radius)
87 {
88 stepMax = std::min(stepMax, twopi * radius);
89 driver = fSmallStepDriver.get();
90 ++fSmallDriverSteps;
91 } else
92 {
93 driver = fLargeStepDriver.get();
94 ++fLargeDriverSteps;
95 }
96
97 if (driver != fCurrDriver)
98 {
99 driver->OnComputeStep();
100 }
101
102 fCurrDriver = driver;
103
104 return fCurrDriver->AdvanceChordLimited(yCurrent, stepMax,
105 epsStep, chordDistance);
106}
double G4double
Definition: G4Types.hh:83
virtual void OnComputeStep()=0
virtual G4double AdvanceChordLimited(G4FieldTrack &track, G4double hstep, G4double eps, G4double chordDistance)=0

◆ ComputeNewStepSize()

virtual G4double G4BFieldIntegrationDriver::ComputeNewStepSize ( G4double  errMaxNorm,
G4double  hstepCurrent 
)
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 104 of file G4BFieldIntegrationDriver.hh.

106 {
107 return fCurrDriver->ComputeNewStepSize(errMaxNorm, hstepCurrent);
108 }
virtual G4double ComputeNewStepSize(G4double errMaxNorm, G4double hstepCurrent)=0

◆ DoesReIntegrate()

virtual G4bool G4BFieldIntegrationDriver::DoesReIntegrate ( ) const
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 66 of file G4BFieldIntegrationDriver.hh.

67 {
68 return fCurrDriver->DoesReIntegrate();
69 }
virtual G4bool DoesReIntegrate() const =0

◆ GetDerivatives() [1/2]

virtual void G4BFieldIntegrationDriver::GetDerivatives ( const G4FieldTrack track,
G4double  dydx[] 
) const
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 72 of file G4BFieldIntegrationDriver.hh.

74 {
75 fCurrDriver->GetDerivatives(track, dydx);
76 }
virtual void GetDerivatives(const G4FieldTrack &track, G4double dydx[]) const =0

◆ GetDerivatives() [2/2]

virtual void G4BFieldIntegrationDriver::GetDerivatives ( const G4FieldTrack track,
G4double  dydx[],
G4double  field[] 
) const
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 79 of file G4BFieldIntegrationDriver.hh.

82 {
83 fCurrDriver->GetDerivatives(track, dydx, field);
84 }

◆ GetEquationOfMotion()

virtual G4EquationOfMotion * G4BFieldIntegrationDriver::GetEquationOfMotion ( )
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 88 of file G4BFieldIntegrationDriver.hh.

89 {
90 return fCurrDriver->GetEquationOfMotion();
91 }

◆ GetStepper() [1/2]

virtual const G4MagIntegratorStepper * G4BFieldIntegrationDriver::GetStepper ( ) const
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 94 of file G4BFieldIntegrationDriver.hh.

95 {
96 return fCurrDriver->GetStepper();
97 }
virtual const G4MagIntegratorStepper * GetStepper() const =0

◆ GetStepper() [2/2]

virtual G4MagIntegratorStepper * G4BFieldIntegrationDriver::GetStepper ( )
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 99 of file G4BFieldIntegrationDriver.hh.

100 {
101 return fCurrDriver->GetStepper();
102 }

◆ GetVerboseLevel()

virtual G4int G4BFieldIntegrationDriver::GetVerboseLevel ( ) const
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 116 of file G4BFieldIntegrationDriver.hh.

117 {
118 return fCurrDriver->GetVerboseLevel();
119 }
virtual G4int GetVerboseLevel() const =0

◆ OnComputeStep()

virtual void G4BFieldIntegrationDriver::OnComputeStep ( )
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 121 of file G4BFieldIntegrationDriver.hh.

122 {
123 fSmallStepDriver->OnComputeStep();
124 fLargeStepDriver->OnComputeStep();
125 }

◆ OnStartTracking()

virtual void G4BFieldIntegrationDriver::OnStartTracking ( )
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 127 of file G4BFieldIntegrationDriver.hh.

128 {
129 fSmallStepDriver->OnStartTracking();
130 fLargeStepDriver->OnStartTracking();
131 }

◆ operator=()

const G4BFieldIntegrationDriver & G4BFieldIntegrationDriver::operator= ( const G4BFieldIntegrationDriver )
delete

◆ PrintStatistics()

void G4BFieldIntegrationDriver::PrintStatistics ( ) const

Definition at line 148 of file G4BFieldIntegrationDriver.cc.

149{
150 const auto totSteps = fSmallDriverSteps + fLargeDriverSteps;
151 const auto toFraction = [&](double value) { return value / totSteps * 100; };
152
153 G4cout << "============= G4BFieldIntegrationDriver statistics ===========\n"
154 << "total steps " << totSteps << " "
155 << "smallDriverSteps " << toFraction(fSmallDriverSteps) << " "
156 << "largeDriverSteps " << toFraction(fLargeDriverSteps) << "\n"
157 << "======================================\n";
158}
G4GLOB_DLL std::ostream G4cout

◆ SetEquationOfMotion()

void G4BFieldIntegrationDriver::SetEquationOfMotion ( G4EquationOfMotion equation)
overridevirtual

Implements G4VIntegrationDriver.

Definition at line 109 of file G4BFieldIntegrationDriver.cc.

110{
111 fEquation = toMagneticEquation(equation);
112 fSmallStepDriver->SetEquationOfMotion(equation);
113 fLargeStepDriver->SetEquationOfMotion(equation);
114}

◆ SetVerboseLevel()

virtual void G4BFieldIntegrationDriver::SetVerboseLevel ( G4int  level)
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 110 of file G4BFieldIntegrationDriver.hh.

111 {
112 fSmallStepDriver->SetVerboseLevel(level);
113 fLargeStepDriver->SetVerboseLevel(level);
114 }

◆ StreamInfo()

virtual void G4BFieldIntegrationDriver::StreamInfo ( std::ostream &  os) const
inlineoverridevirtual

Implements G4VIntegrationDriver.

Definition at line 133 of file G4BFieldIntegrationDriver.hh.

134 {
135 os << "Small Step Driver Info: " << std::endl;
136 fSmallStepDriver->StreamInfo(os);
137 os << "Large Step Driver Info: " << std::endl;
138 fLargeStepDriver->StreamInfo(os);
139 }

The documentation for this class was generated from the following files: