Import Geant4 10.5.0 source tree
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FSALIntegrationDriver.hh 109569 2018-05-02 07:08:33Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4FSALIntegrationDriver
|
||||
@@ -32,7 +31,7 @@
|
||||
// Class description:
|
||||
//
|
||||
// Driver class which controls the integration error of a
|
||||
// Runge-Kutta stepper with a FSAL property
|
||||
// Runge-Kutta stepper
|
||||
|
||||
// History:
|
||||
// - Created. D.Sorokin
|
||||
@@ -41,24 +40,38 @@
|
||||
#ifndef G4FSALIntegrationDriver_HH
|
||||
#define G4FSALIntegrationDriver_HH
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4FieldTrack.hh"
|
||||
#include "G4VIntegrationDriver.hh"
|
||||
#include "G4RKIntegrationDriver.hh"
|
||||
#include "G4ChordFinderDelegate.hh"
|
||||
|
||||
template <class T>
|
||||
class G4FSALIntegrationDriver : public G4VIntegrationDriver {
|
||||
class G4FSALIntegrationDriver : public G4RKIntegrationDriver<T> ,
|
||||
public G4ChordFinderDelegate<G4FSALIntegrationDriver<T>> {
|
||||
public:
|
||||
G4FSALIntegrationDriver(
|
||||
G4double hminimum,
|
||||
T* stepper,
|
||||
G4int numberOfComponents = 6,
|
||||
G4int statisticsVerbosity = 1);
|
||||
G4FSALIntegrationDriver( G4double hminimum,
|
||||
T* stepper,
|
||||
G4int numberOfComponents = 6,
|
||||
G4int statisticsVerbosity = 1);
|
||||
|
||||
virtual ~G4FSALIntegrationDriver() override;
|
||||
|
||||
G4FSALIntegrationDriver(const G4FSALIntegrationDriver &) = delete;
|
||||
const G4FSALIntegrationDriver& operator =(const G4FSALIntegrationDriver &) = delete;
|
||||
|
||||
virtual G4double AdvanceChordLimited(G4FieldTrack& track,
|
||||
G4double hstep,
|
||||
G4double eps,
|
||||
G4double chordDistance) override
|
||||
{
|
||||
return ChordFinderDelegate::AdvanceChordLimitedImpl(track, hstep, eps, chordDistance);
|
||||
}
|
||||
|
||||
virtual void OnStartTracking() override
|
||||
{
|
||||
ChordFinderDelegate::ResetStepEstimate();
|
||||
}
|
||||
|
||||
virtual void OnComputeStep() override {};
|
||||
|
||||
// Integrates ODE from current s (s=s0) to s=s0+h with accuracy eps.
|
||||
// On output track is replaced by value at end of interval.
|
||||
// The concept is similar to the odeint routine from NRC p.721-722.
|
||||
@@ -73,115 +86,59 @@ public:
|
||||
G4FieldTrack& fieldTrack,
|
||||
const G4double dydx[],
|
||||
G4double hstep,
|
||||
G4double inverseCurvatureRadius,
|
||||
G4double& dchord_step,
|
||||
G4double& dyerr) override;
|
||||
|
||||
virtual void GetDerivatives(
|
||||
const G4FieldTrack &track,
|
||||
G4double dydx[]) const override;
|
||||
|
||||
// Taking the last step's normalised error, calculate
|
||||
// a step size for the next step.
|
||||
// Do not limit the next step's size within a factor of the
|
||||
// current one.
|
||||
virtual G4double ComputeNewStepSize(
|
||||
G4double errMaxNorm, // normalised error
|
||||
G4double hstepCurrent) override; // current step size
|
||||
|
||||
virtual void SetVerboseLevel(G4int newLevel) override;
|
||||
virtual G4int GetVerboseLevel() const override;
|
||||
|
||||
virtual G4EquationOfMotion* GetEquationOfMotion() override;
|
||||
virtual void SetEquationOfMotion(G4EquationOfMotion* equation) override;
|
||||
|
||||
virtual const G4MagIntegratorStepper* GetStepper() const override;
|
||||
virtual G4MagIntegratorStepper* GetStepper() override;
|
||||
|
||||
const T* GetStepperOfPreciseType() const; // Get ptr of precise type
|
||||
T* GetStepperOfPreciseType();
|
||||
|
||||
// Accessors.
|
||||
G4double GetMinimumStep() const;
|
||||
G4double GetSafety() const;
|
||||
G4double GetPshrnk() const;
|
||||
G4double GetPgrow() const;
|
||||
|
||||
virtual void RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper) override;
|
||||
|
||||
// Sets a new stepper pItsStepper for this driver. Then it calls
|
||||
// ReSetParameters to reset its parameters accordingly.
|
||||
inline void RenewStepperAndAdjustStrict(T *pItsStepper);
|
||||
|
||||
// i) sets the exponents (pgrow & pshrnk),
|
||||
// using the current Stepper's order,
|
||||
// ii) sets the safety
|
||||
void ReSetParameters(G4double safety = 0.9);
|
||||
|
||||
|
||||
void SetMinimumStep(G4double newval);
|
||||
void SetSafety(G4double valS);
|
||||
|
||||
// This takes one Step that is as large as possible while
|
||||
// satisfying the accuracy criterion of:
|
||||
// yerr < eps * |y_end-y_start|
|
||||
void OneGoodStep(
|
||||
G4double ystart[],
|
||||
G4double dydx[],
|
||||
G4double& curveLength,
|
||||
G4double htry,
|
||||
G4double eps,
|
||||
G4double& hdid,
|
||||
G4double& hnext);
|
||||
|
||||
// Modify and Get the Maximum number of Steps that can be
|
||||
// taken for the integration of a single segment -
|
||||
// (ie a single call to AccurateAdvance).
|
||||
G4int GetMaxNoSteps() const;
|
||||
void SetMaxNoSteps( G4int val);
|
||||
// This takes one Step that is of size htry, or as large
|
||||
// as possible while satisfying the accuracy criterion of:
|
||||
// yerr < eps * |y_end-y_start|
|
||||
void OneGoodStep(G4double y[], // InOut
|
||||
G4double dydx[],
|
||||
G4double& curveLength,
|
||||
G4double htry,
|
||||
G4double eps,
|
||||
G4double& hdid,
|
||||
G4double& hnext);
|
||||
|
||||
G4double GetSmallestFraction() const;
|
||||
void SetSmallestFraction(G4double val);
|
||||
|
||||
protected:
|
||||
void IncrementQuickAdvanceCalls();
|
||||
|
||||
private:
|
||||
G4double ShrinkStepSize(G4double h, G4double error) const;
|
||||
G4double GrowStepSize(G4double h, G4double error) const;
|
||||
void UpdateErrorConstraints();
|
||||
void CheckStep(const G4ThreeVector& posIn,
|
||||
const G4ThreeVector& posOut,
|
||||
G4double hdid);
|
||||
|
||||
void CheckStep(
|
||||
const G4ThreeVector& posIn, const G4ThreeVector& posOut, G4double hdid);
|
||||
// Minimum Step allowed in a Step (in absolute units)
|
||||
G4double fMinimumStep;
|
||||
|
||||
// Minimum Step allowed in a Step (in absolute units)
|
||||
G4double fMinimumStep;
|
||||
// Smallest fraction of (existing) curve length - in relative units
|
||||
// below this fraction the current step will be the last
|
||||
G4double fSmallestFraction;
|
||||
// Expected range: smaller than 0.1 * epsilon and bigger than 5e-13
|
||||
// ( Note: this range is not enforced. )
|
||||
|
||||
// Smallest fraction of (existing) curve length - in relative units
|
||||
// below this fraction the current step will be the last
|
||||
// Expected range 1e-12 to 5e-15;
|
||||
G4double fSmallestFraction;
|
||||
// Verbosity level for printing (debug, ..)
|
||||
// Could be varied during tracking - to help identify issues
|
||||
G4int fVerboseLevel;
|
||||
|
||||
G4int fMaxNoSteps;
|
||||
G4int fNoQuickAvanceCalls;
|
||||
G4int fNoAccurateAdvanceCalls;
|
||||
G4int fNoAccurateAdvanceBadSteps;
|
||||
G4int fNoAccurateAdvanceGoodSteps;
|
||||
|
||||
// The (default) maximum number of steps is Base
|
||||
// divided by the order of Stepper
|
||||
G4int fMaxStepBase;
|
||||
|
||||
// Parameters used to grow and shrink trial stepsize.
|
||||
G4double safety;
|
||||
G4double pshrnk; // exponent for shrinking
|
||||
G4double pgrow; // exponent for growth
|
||||
|
||||
// muximum error values for shrinking / growing (optimisation).
|
||||
G4double errorConstraintShrink;
|
||||
G4double errorConstraintGrow;
|
||||
|
||||
T* pIntStepper;
|
||||
|
||||
// Step Statistics
|
||||
unsigned long fNoTotalSteps, fNoBadSteps, fNoGoodSteps;
|
||||
|
||||
G4int fVerboseLevel; // Verbosity level for printing (debug, ..)
|
||||
// Could be varied during tracking - to help identify issues
|
||||
|
||||
G4int fNoQuickAvanceCalls;
|
||||
using Base = G4RKIntegrationDriver<T>;
|
||||
using ChordFinderDelegate = G4ChordFinderDelegate<G4FSALIntegrationDriver<T>>;
|
||||
};
|
||||
|
||||
#include "G4FSALIntegrationDriver.icc"
|
||||
|
||||
Reference in New Issue
Block a user