Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4InterpolationDriver< T, StepperCachesDchord > Class Template Reference

G4InterpolationDriver is a templated driver class which uses Runge-Kutta stepper with interpolation property to integrate track with error control. More...

#include <G4InterpolationDriver.hh>

Inheritance diagram for G4InterpolationDriver< T, StepperCachesDchord >:

Classes

struct  InterpStepper

Public Member Functions

 G4InterpolationDriver (G4double hminimum, T *stepper, G4int numberOfComponents=6, G4int statisticsVerbosity=0)
 ~G4InterpolationDriver () override
 G4InterpolationDriver (const G4InterpolationDriver &)=delete
const G4InterpolationDriveroperator= (const G4InterpolationDriver &)=delete
G4double AdvanceChordLimited (G4FieldTrack &track, G4double hstep, G4double eps, G4double chordDistance) override
void OnStartTracking () override
void OnComputeStep (const G4FieldTrack *=nullptr) override
G4bool DoesReIntegrate () const override
G4bool AccurateAdvance (G4FieldTrack &track, G4double hstep, G4double eps, G4double hinitial=0) override
void SetVerboseLevel (G4int level) override
G4int GetVerboseLevel () const override
void StreamInfo (std::ostream &os) const override
Public Member Functions inherited from G4RKIntegrationDriver< T >
 G4RKIntegrationDriver (T *stepper)
 G4RKIntegrationDriver (const G4RKIntegrationDriver &)=delete
G4RKIntegrationDriveroperator= (const G4RKIntegrationDriver &)=delete
void GetDerivatives (const G4FieldTrack &track, G4double dydx[]) const override
void GetDerivatives (const G4FieldTrack &track, G4double dydx[], G4double field[]) const override
G4double ComputeNewStepSize (G4double errMaxNorm, G4double hstepCurrent) final
G4EquationOfMotionGetEquationOfMotion () override
void SetEquationOfMotion (G4EquationOfMotion *equation) override
const T * GetStepper () const override
T * GetStepper () override
void StreamInfo (std::ostream &os) const override
G4double GetSafety () const
G4double GetPshrnk () const
G4double GetPgrow () const
void RenewStepperAndAdjust (G4MagIntegratorStepper *stepper) override
void ReSetParameters (G4double safety=0.9)
void SetSafety (G4double valS)
G4int GetMaxNoSteps () const
void SetMaxNoSteps (G4int val)
G4double GetSmallestFraction () const
void SetSmallestFraction (G4double val)
Public Member Functions inherited from G4VIntegrationDriver
virtual ~G4VIntegrationDriver ()=default
virtual G4bool QuickAdvance (G4FieldTrack &, const G4double[], G4double, G4double &, G4double &)

Protected Types

using StepperIterator = typename std::vector<InterpStepper>::iterator
using ConstStepperIterator = typename std::vector<InterpStepper>::const_iterator
using Base = G4RKIntegrationDriver<T>

Protected Member Functions

virtual G4double OneGoodStep (StepperIterator it, field_utils::State &y, field_utils::State &dydx, G4double &hstep, G4double eps, G4double curveLength, G4FieldTrack *track=nullptr)
void Interpolate (G4double curveLength, field_utils::State &y) const
void InterpolateImpl (G4double curveLength, ConstStepperIterator it, field_utils::State &y) const
G4double DistChord (const field_utils::State &yBegin, G4double curveLengthBegin, const field_utils::State &yEnd, G4double curveLengthEnd) const
G4double FindNextChord (const field_utils::State &yBegin, G4double curveLengthBegin, field_utils::State &yEnd, G4double curveLengthEnd, G4double dChord, G4double maxChordDistance)
G4double CalcChordStep (G4double stepTrialOld, G4double dChordStep, G4double fDeltaChord)
void PrintState () const
void CheckState () const
void AccumulateStatistics (G4int noTrials)
Protected Member Functions inherited from G4RKIntegrationDriver< T >
G4double ShrinkStepSize (G4double h, G4double error) const
G4double GrowStepSize (G4double h, G4double error) const
G4double ShrinkStepSize2 (G4double h, G4double error2) const
G4double GrowStepSize2 (G4double h, G4double error2) const
void UpdateErrorConstraints ()

Protected Attributes

std::vector< InterpStepperfSteppers
StepperIterator fLastStepper
G4bool fKeepLastStepper = false
G4double fhnext = DBL_MAX
G4double fMinimumStep
G4double fChordStepEstimate = DBL_MAX
const G4double fFractionNextEstimate = 0.98
const G4double fSmallestCurveFraction = 0.01
G4int fVerboseLevel
field_utils::State fdydx
G4bool fFirstStep = true
G4int fMaxTrials = 100
G4int fTotalStepsForTrack = 0
G4int fTotalNoTrials = 0
G4int fNoCalls = 0
G4int fmaxTrials = 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

template<class T, G4bool StepperCachesDchord = true>
class G4InterpolationDriver< T, StepperCachesDchord >

G4InterpolationDriver is a templated driver class which uses Runge-Kutta stepper with interpolation property to integrate track with error control.

Definition at line 52 of file G4InterpolationDriver.hh.

Member Typedef Documentation

◆ Base

template<class T, G4bool StepperCachesDchord = true>
using G4InterpolationDriver< T, StepperCachesDchord >::Base = G4RKIntegrationDriver<T>
protected

Definition at line 238 of file G4InterpolationDriver.hh.

◆ ConstStepperIterator

template<class T, G4bool StepperCachesDchord = true>
using G4InterpolationDriver< T, StepperCachesDchord >::ConstStepperIterator = typename std::vector<InterpStepper>::const_iterator
protected

Definition at line 144 of file G4InterpolationDriver.hh.

◆ StepperIterator

template<class T, G4bool StepperCachesDchord = true>
using G4InterpolationDriver< T, StepperCachesDchord >::StepperIterator = typename std::vector<InterpStepper>::iterator
protected

Definition at line 143 of file G4InterpolationDriver.hh.

Constructor & Destructor Documentation

◆ G4InterpolationDriver() [1/2]

template<class T, G4bool StepperCachesDchord = true>
G4InterpolationDriver< T, StepperCachesDchord >::G4InterpolationDriver ( G4double hminimum,
T * stepper,
G4int numberOfComponents = 6,
G4int statisticsVerbosity = 0 )

Constructor for G4IntegrationDriver.

Parameters
[in]hminimumMinimum allowed step.
[in]stepperPointer to the stepper algorithm.
[in]numberOfComponentsThe number of integration variables, if not matching stepper's number of variables, issue exception.
[in]statisticsVerbosityVerbosity level.

◆ ~G4InterpolationDriver()

template<class T, G4bool StepperCachesDchord = true>
G4InterpolationDriver< T, StepperCachesDchord >::~G4InterpolationDriver ( )
override

Destructor. Provides statistics if verbosity level is greater than zero.

◆ G4InterpolationDriver() [2/2]

template<class T, G4bool StepperCachesDchord = true>
G4InterpolationDriver< T, StepperCachesDchord >::G4InterpolationDriver ( const G4InterpolationDriver< T, StepperCachesDchord > & )
delete

Copy constructor and assignment operator not allowed.

Member Function Documentation

◆ AccumulateStatistics()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::AccumulateStatistics ( G4int noTrials)
protected

Increments number of trials and calls.

◆ AccurateAdvance()

template<class T, G4bool StepperCachesDchord = true>
G4bool G4InterpolationDriver< T, StepperCachesDchord >::AccurateAdvance ( G4FieldTrack & track,
G4double hstep,
G4double eps,
G4double hinitial = 0 )
overridevirtual

Advances integration accurately by relative accuracy better than 'eps'. On output the track is replaced by the value at the end of interval.

Parameters
[in,out]trackThe current track in field.
[in]hstepProposed step length.
[in]epsRequested accuracy, y_err/hstep.
[in]hinitialInitial minimum integration step.
Returns
true if integration succeeds.

Implements G4VIntegrationDriver.

◆ AdvanceChordLimited()

template<class T, G4bool StepperCachesDchord = true>
G4double G4InterpolationDriver< T, StepperCachesDchord >::AdvanceChordLimited ( G4FieldTrack & track,
G4double hstep,
G4double eps,
G4double chordDistance )
overridevirtual

Computes the step to take, based on chord limits.

Parameters
[in,out]trackThe current track in field.
[in]hstepProposed step length.
[in]epsRequested accuracy, y_err/hstep.
[in]chordDistanceMaximum sagitta distance.
Returns
The length of step taken.

Implements G4VIntegrationDriver.

Reimplemented in G4QSSDriver< T >.

◆ CalcChordStep()

template<class T, G4bool StepperCachesDchord = true>
G4double G4InterpolationDriver< T, StepperCachesDchord >::CalcChordStep ( G4double stepTrialOld,
G4double dChordStep,
G4double fDeltaChord )
protected

◆ CheckState()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::CheckState ( ) const
protected

◆ DistChord()

template<class T, G4bool StepperCachesDchord = true>
G4double G4InterpolationDriver< T, StepperCachesDchord >::DistChord ( const field_utils::State & yBegin,
G4double curveLengthBegin,
const field_utils::State & yEnd,
G4double curveLengthEnd ) const
protected

Methods for calculation of chord step and distance.

◆ DoesReIntegrate()

template<class T, G4bool StepperCachesDchord = true>
G4bool G4InterpolationDriver< T, StepperCachesDchord >::DoesReIntegrate ( ) const
inlineoverridevirtual

The driver does not implement re-integration. Returns false.

Implements G4VIntegrationDriver.

Definition at line 106 of file G4InterpolationDriver.hh.

106{ return false; }

◆ FindNextChord()

template<class T, G4bool StepperCachesDchord = true>
G4double G4InterpolationDriver< T, StepperCachesDchord >::FindNextChord ( const field_utils::State & yBegin,
G4double curveLengthBegin,
field_utils::State & yEnd,
G4double curveLengthEnd,
G4double dChord,
G4double maxChordDistance )
protected

◆ GetVerboseLevel()

template<class T, G4bool StepperCachesDchord = true>
G4int G4InterpolationDriver< T, StepperCachesDchord >::GetVerboseLevel ( ) const
overridevirtual

Implements G4VIntegrationDriver.

◆ Interpolate()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::Interpolate ( G4double curveLength,
field_utils::State & y ) const
protected

Track interpolation.

Parameters
[in]curveLengthStep start, x.
[in,out]yThe current track state, y.

◆ InterpolateImpl()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::InterpolateImpl ( G4double curveLength,
ConstStepperIterator it,
field_utils::State & y ) const
protected

Wrapper method for interpolation.

◆ OnComputeStep()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::OnComputeStep ( const G4FieldTrack * = nullptr)
overridevirtual

Dispatch interface method for computing step. Does nothing here.

Implements G4VIntegrationDriver.

Reimplemented in G4QSSDriver< T >.

◆ OneGoodStep()

template<class T, G4bool StepperCachesDchord = true>
virtual G4double G4InterpolationDriver< T, StepperCachesDchord >::OneGoodStep ( StepperIterator it,
field_utils::State & y,
field_utils::State & dydx,
G4double & hstep,
G4double eps,
G4double curveLength,
G4FieldTrack * track = nullptr )
protectedvirtual

Takes one Step that is as large as possible while satisfying the accuracy criterion.

Parameters
[in]itStepper iterator.
[in,out]yThe current track state, y.
[in]dydxdydx array.
[in,out]hstepStep to attempt.
[in]epsThe relative accuracy.
[in]curveLengthStep start, x.
[in,out]trackPointer to the Field track. Not used.
Returns
The step achieved.

◆ OnStartTracking()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::OnStartTracking ( )
overridevirtual

Dispatch interface method for initialisation/reset of driver.

Implements G4VIntegrationDriver.

Reimplemented in G4QSSDriver< T >.

◆ operator=()

template<class T, G4bool StepperCachesDchord = true>
const G4InterpolationDriver & G4InterpolationDriver< T, StepperCachesDchord >::operator= ( const G4InterpolationDriver< T, StepperCachesDchord > & )
delete

◆ PrintState()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::PrintState ( ) const
protected

Internal methods for printing/checking the state.

◆ SetVerboseLevel()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::SetVerboseLevel ( G4int level)
overridevirtual

Setter and getter for verbosity.

Implements G4VIntegrationDriver.

◆ StreamInfo()

template<class T, G4bool StepperCachesDchord = true>
void G4InterpolationDriver< T, StepperCachesDchord >::StreamInfo ( std::ostream & os) const
overridevirtual

Writes out to stream the parameters/state of the driver.

Implements G4VIntegrationDriver.

Member Data Documentation

◆ fChordStepEstimate

template<class T, G4bool StepperCachesDchord = true>
G4double G4InterpolationDriver< T, StepperCachesDchord >::fChordStepEstimate = DBL_MAX
protected

Definition at line 221 of file G4InterpolationDriver.hh.

◆ fdydx

template<class T, G4bool StepperCachesDchord = true>
field_utils::State G4InterpolationDriver< T, StepperCachesDchord >::fdydx
protected

Definition at line 227 of file G4InterpolationDriver.hh.

◆ fFirstStep

template<class T, G4bool StepperCachesDchord = true>
G4bool G4InterpolationDriver< T, StepperCachesDchord >::fFirstStep = true
protected

Definition at line 228 of file G4InterpolationDriver.hh.

◆ fFractionNextEstimate

template<class T, G4bool StepperCachesDchord = true>
const G4double G4InterpolationDriver< T, StepperCachesDchord >::fFractionNextEstimate = 0.98
protected

Definition at line 222 of file G4InterpolationDriver.hh.

◆ fhnext

template<class T, G4bool StepperCachesDchord = true>
G4double G4InterpolationDriver< T, StepperCachesDchord >::fhnext = DBL_MAX
protected

Memory of last good step size for integration.

Definition at line 216 of file G4InterpolationDriver.hh.

◆ fKeepLastStepper

template<class T, G4bool StepperCachesDchord = true>
G4bool G4InterpolationDriver< T, StepperCachesDchord >::fKeepLastStepper = false
protected

Definition at line 213 of file G4InterpolationDriver.hh.

◆ fLastStepper

template<class T, G4bool StepperCachesDchord = true>
StepperIterator G4InterpolationDriver< T, StepperCachesDchord >::fLastStepper
protected

Definition at line 212 of file G4InterpolationDriver.hh.

◆ fMaxTrials

template<class T, G4bool StepperCachesDchord = true>
G4int G4InterpolationDriver< T, StepperCachesDchord >::fMaxTrials = 100
protected

Definition at line 230 of file G4InterpolationDriver.hh.

◆ fmaxTrials

template<class T, G4bool StepperCachesDchord = true>
G4int G4InterpolationDriver< T, StepperCachesDchord >::fmaxTrials = 0
protected

Definition at line 236 of file G4InterpolationDriver.hh.

◆ fMinimumStep

template<class T, G4bool StepperCachesDchord = true>
G4double G4InterpolationDriver< T, StepperCachesDchord >::fMinimumStep
protected

Minimum Step allowed (in units of length).

Definition at line 219 of file G4InterpolationDriver.hh.

◆ fNoCalls

template<class T, G4bool StepperCachesDchord = true>
G4int G4InterpolationDriver< T, StepperCachesDchord >::fNoCalls = 0
protected

Definition at line 235 of file G4InterpolationDriver.hh.

◆ fSmallestCurveFraction

template<class T, G4bool StepperCachesDchord = true>
const G4double G4InterpolationDriver< T, StepperCachesDchord >::fSmallestCurveFraction = 0.01
protected

Definition at line 223 of file G4InterpolationDriver.hh.

◆ fSteppers

template<class T, G4bool StepperCachesDchord = true>
std::vector<InterpStepper> G4InterpolationDriver< T, StepperCachesDchord >::fSteppers
protected

Definition at line 211 of file G4InterpolationDriver.hh.

◆ fTotalNoTrials

template<class T, G4bool StepperCachesDchord = true>
G4int G4InterpolationDriver< T, StepperCachesDchord >::fTotalNoTrials = 0
protected

Statistics.

Definition at line 234 of file G4InterpolationDriver.hh.

◆ fTotalStepsForTrack

template<class T, G4bool StepperCachesDchord = true>
G4int G4InterpolationDriver< T, StepperCachesDchord >::fTotalStepsForTrack = 0
protected

Definition at line 231 of file G4InterpolationDriver.hh.

◆ fVerboseLevel

template<class T, G4bool StepperCachesDchord = true>
G4int G4InterpolationDriver< T, StepperCachesDchord >::fVerboseLevel
protected

Definition at line 225 of file G4InterpolationDriver.hh.


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