Geant4-11
Public Member Functions | Protected Member Functions | Private Attributes
G4MagErrorStepper Class Referenceabstract

#include <G4MagErrorStepper.hh>

Inheritance diagram for G4MagErrorStepper:
G4MagIntegratorStepper G4ClassicalRK4 G4ConstRK4 G4ExplicitEuler G4ImplicitEuler G4SimpleHeum G4SimpleRunge

Public Member Functions

G4double DistChord () const
 
virtual void DumbStepper (const G4double y[], const G4double dydx[], G4double h, G4double yout[])=0
 
 G4MagErrorStepper (const G4MagErrorStepper &)=delete
 
 G4MagErrorStepper (G4EquationOfMotion *EqRhs, G4int numberOfVariables, G4int numStateVariables=12)
 
G4EquationOfMotionGetEquationOfMotion ()
 
const G4EquationOfMotionGetEquationOfMotion () const
 
unsigned long GetfNoRHSCalls ()
 
G4int GetNumberOfStateVariables () const
 
G4int GetNumberOfVariables () const
 
G4int IntegrationOrder ()
 
virtual G4int IntegratorOrder () const =0
 
G4bool IsFSAL () const
 
void NormalisePolarizationVector (G4double vec[12])
 
void NormaliseTangentVector (G4double vec[6])
 
G4MagErrorStepperoperator= (const G4MagErrorStepper &)=delete
 
void ResetfNORHSCalls ()
 
void RightHandSide (const G4double y[], G4double dydx[]) const
 
void RightHandSide (const G4double y[], G4double dydx[], G4double field[]) const
 
void SetEquationOfMotion (G4EquationOfMotion *newEquation)
 
void Stepper (const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[])
 
virtual ~G4MagErrorStepper ()
 

Protected Member Functions

void SetFSAL (G4bool flag=true)
 
void SetIntegrationOrder (G4int order)
 

Private Attributes

G4doubledydxMid
 
G4EquationOfMotionfEquation_Rhs = nullptr
 
G4ThreeVector fFinalPoint
 
G4ThreeVector fInitialPoint
 
G4int fIntegrationOrder = -1
 
G4bool fIsFSAL = false
 
G4ThreeVector fMidPoint
 
const G4int fNoIntegrationVariables = 0
 
unsigned long fNoRHSCalls = 0UL
 
const G4int fNoStateVariables = 0
 
G4doubleyInitial
 
G4doubleyMiddle
 
G4doubleyOneStep
 

Detailed Description

Definition at line 43 of file G4MagErrorStepper.hh.

Constructor & Destructor Documentation

◆ G4MagErrorStepper() [1/2]

G4MagErrorStepper::G4MagErrorStepper ( G4EquationOfMotion EqRhs,
G4int  numberOfVariables,
G4int  numStateVariables = 12 
)

◆ ~G4MagErrorStepper()

G4MagErrorStepper::~G4MagErrorStepper ( )
virtual

Definition at line 34 of file G4MagErrorStepper.cc.

35{
36 delete [] yMiddle;
37 delete [] dydxMid;
38 delete [] yInitial;
39 delete [] yOneStep;
40}

References dydxMid, yInitial, yMiddle, and yOneStep.

◆ G4MagErrorStepper() [2/2]

G4MagErrorStepper::G4MagErrorStepper ( const G4MagErrorStepper )
delete

Member Function Documentation

◆ DistChord()

G4double G4MagErrorStepper::DistChord ( ) const
virtual

Implements G4MagIntegratorStepper.

Definition at line 100 of file G4MagErrorStepper.cc.

101{
102 // Estimate the maximum distance from the curve to the chord
103 //
104 // We estimate this using the distance of the midpoint to
105 // chord (the line between
106 //
107 // Method below is good only for angle deviations < 2 pi,
108 // This restriction should not a problem for the Runge cutta methods,
109 // which generally cannot integrate accurately for large angle deviations.
110
111 G4double distLine, distChord;
112
114 {
116 // This is a class method that gives distance of Mid
117 // from the Chord between the Initial and Final points.
118
119 distChord = distLine;
120 }
121 else
122 {
123 distChord = (fMidPoint-fInitialPoint).mag();
124 }
125
126 return distChord;
127}
double G4double
Definition: G4Types.hh:83
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
G4ThreeVector fMidPoint
G4ThreeVector fFinalPoint
G4ThreeVector fInitialPoint

References G4LineSection::Distline(), fFinalPoint, fInitialPoint, and fMidPoint.

◆ DumbStepper()

virtual void G4MagErrorStepper::DumbStepper ( const G4double  y[],
const G4double  dydx[],
G4double  h,
G4double  yout[] 
)
pure virtual

◆ GetEquationOfMotion() [1/2]

G4EquationOfMotion * G4MagIntegratorStepper::GetEquationOfMotion ( )
inlineinherited

◆ GetEquationOfMotion() [2/2]

const G4EquationOfMotion * G4MagIntegratorStepper::GetEquationOfMotion ( ) const
inlineinherited

◆ GetfNoRHSCalls()

unsigned long G4MagIntegratorStepper::GetfNoRHSCalls ( )
inlineinherited

◆ GetNumberOfStateVariables()

G4int G4MagIntegratorStepper::GetNumberOfStateVariables ( ) const
inlineinherited

◆ GetNumberOfVariables()

G4int G4MagIntegratorStepper::GetNumberOfVariables ( ) const
inlineinherited

◆ IntegrationOrder()

G4int G4MagIntegratorStepper::IntegrationOrder ( )
inlineinherited

◆ IntegratorOrder()

virtual G4int G4MagIntegratorStepper::IntegratorOrder ( ) const
pure virtualinherited

◆ IsFSAL()

G4bool G4MagIntegratorStepper::IsFSAL ( ) const
inlineinherited

◆ NormalisePolarizationVector()

void G4MagIntegratorStepper::NormalisePolarizationVector ( G4double  vec[12])
inlineinherited

◆ NormaliseTangentVector()

void G4MagIntegratorStepper::NormaliseTangentVector ( G4double  vec[6])
inlineinherited

◆ operator=()

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

◆ ResetfNORHSCalls()

void G4MagIntegratorStepper::ResetfNORHSCalls ( )
inlineinherited

◆ RightHandSide() [1/2]

void G4MagIntegratorStepper::RightHandSide ( const G4double  y[],
G4double  dydx[] 
) const
inlineinherited

◆ RightHandSide() [2/2]

void G4MagIntegratorStepper::RightHandSide ( const G4double  y[],
G4double  dydx[],
G4double  field[] 
) const
inlineinherited

◆ SetEquationOfMotion()

void G4MagIntegratorStepper::SetEquationOfMotion ( G4EquationOfMotion newEquation)
inlineinherited

◆ SetFSAL()

void G4MagIntegratorStepper::SetFSAL ( G4bool  flag = true)
inlineprotectedinherited

◆ SetIntegrationOrder()

void G4MagIntegratorStepper::SetIntegrationOrder ( G4int  order)
inlineprotectedinherited

◆ Stepper()

void G4MagErrorStepper::Stepper ( const G4double  y[],
const G4double  dydx[],
G4double  h,
G4double  yout[],
G4double  yerr[] 
)
virtual

Implements G4MagIntegratorStepper.

Definition at line 42 of file G4MagErrorStepper.cc.

47{
48 const G4int nvar = GetNumberOfVariables();
49 const G4int maxvar = GetNumberOfStateVariables();
50
51 // correction for Richardson Extrapolation.
52 //
53 G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );
54
55 // Saving yInput because yInput and yOutput can be aliases for same array
56 //
57 for(G4int i=0; i<nvar; ++i)
58 {
59 yInitial[i]=yInput[i];
60 }
61 yInitial[7] = yInput[7]; // Copy the time in case...even if not really needed
62 yMiddle[7] = yInput[7]; // Copy the time from initial value
63 yOneStep[7] = yInput[7]; // As it contributes to final value of yOutput ?
64 // yOutput[7] = yInput[7]; // -> dumb stepper does it too for RK4
65
66 for(G4int i=nvar; i<maxvar; ++i)
67 {
68 yOutput[i]=yInput[i];
69 }
70 // yError[7] = 0.0;
71
72 G4double halfStep = hstep * 0.5;
73
74 // Do two half steps
75 //
76 DumbStepper (yInitial, dydx, halfStep, yMiddle);
78 DumbStepper (yMiddle, dydxMid, halfStep, yOutput);
79
80 // Store midpoint, chord calculation
81 //
83
84 // Do a full Step
85 //
86 DumbStepper(yInitial, dydx, hstep, yOneStep);
87 for(G4int i=0; i<nvar; ++i)
88 {
89 yError [i] = yOutput[i] - yOneStep[i] ;
90 yOutput[i] += yError[i]*correction ;
91 // Provides accuracy increased by 1 order via Richardson Extrapolation
92 }
93
95 fFinalPoint = G4ThreeVector( yOutput[0], yOutput[1], yOutput[2]);
96
97 return;
98}
CLHEP::Hep3Vector G4ThreeVector
int G4int
Definition: G4Types.hh:85
virtual void DumbStepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[])=0
G4int GetNumberOfVariables() const
void RightHandSide(const G4double y[], G4double dydx[]) const
G4int GetNumberOfStateVariables() const
virtual G4int IntegratorOrder() const =0

References DumbStepper(), dydxMid, fFinalPoint, fInitialPoint, fMidPoint, G4MagIntegratorStepper::GetNumberOfStateVariables(), G4MagIntegratorStepper::GetNumberOfVariables(), G4MagIntegratorStepper::IntegratorOrder(), G4MagIntegratorStepper::RightHandSide(), yInitial, yMiddle, and yOneStep.

Field Documentation

◆ dydxMid

G4double * G4MagErrorStepper::dydxMid
private

Definition at line 80 of file G4MagErrorStepper.hh.

Referenced by Stepper(), and ~G4MagErrorStepper().

◆ fEquation_Rhs

G4EquationOfMotion* G4MagIntegratorStepper::fEquation_Rhs = nullptr
privateinherited

Definition at line 124 of file G4MagIntegratorStepper.hh.

◆ fFinalPoint

G4ThreeVector G4MagErrorStepper::fFinalPoint
private

Definition at line 76 of file G4MagErrorStepper.hh.

Referenced by DistChord(), and Stepper().

◆ fInitialPoint

G4ThreeVector G4MagErrorStepper::fInitialPoint
private

Definition at line 76 of file G4MagErrorStepper.hh.

Referenced by DistChord(), and Stepper().

◆ fIntegrationOrder

G4int G4MagIntegratorStepper::fIntegrationOrder = -1
privateinherited

Definition at line 134 of file G4MagIntegratorStepper.hh.

◆ fIsFSAL

G4bool G4MagIntegratorStepper::fIsFSAL = false
privateinherited

Definition at line 136 of file G4MagIntegratorStepper.hh.

◆ fMidPoint

G4ThreeVector G4MagErrorStepper::fMidPoint
private

Definition at line 76 of file G4MagErrorStepper.hh.

Referenced by DistChord(), and Stepper().

◆ fNoIntegrationVariables

const G4int G4MagIntegratorStepper::fNoIntegrationVariables = 0
privateinherited

Definition at line 125 of file G4MagIntegratorStepper.hh.

◆ fNoRHSCalls

unsigned long G4MagIntegratorStepper::fNoRHSCalls = 0UL
mutableprivateinherited

Definition at line 128 of file G4MagIntegratorStepper.hh.

◆ fNoStateVariables

const G4int G4MagIntegratorStepper::fNoStateVariables = 0
privateinherited

Definition at line 126 of file G4MagIntegratorStepper.hh.

◆ yInitial

G4double* G4MagErrorStepper::yInitial
private

Definition at line 80 of file G4MagErrorStepper.hh.

Referenced by Stepper(), and ~G4MagErrorStepper().

◆ yMiddle

G4double * G4MagErrorStepper::yMiddle
private

Definition at line 80 of file G4MagErrorStepper.hh.

Referenced by Stepper(), and ~G4MagErrorStepper().

◆ yOneStep

G4double * G4MagErrorStepper::yOneStep
private

Definition at line 80 of file G4MagErrorStepper.hh.

Referenced by Stepper(), and ~G4MagErrorStepper().


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