Geant4-11
Public Member Functions | Protected Member Functions | Private Attributes
G4SimpleHeum Class Reference

#include <G4SimpleHeum.hh>

Inheritance diagram for G4SimpleHeum:
G4MagErrorStepper G4MagIntegratorStepper

Public Member Functions

G4double DistChord () const
 
void DumbStepper (const G4double y[], const G4double dydx[], G4double h, G4double yout[])
 
 G4SimpleHeum (G4EquationOfMotion *EqRhs, G4int num_variables=6)
 
G4EquationOfMotionGetEquationOfMotion ()
 
const G4EquationOfMotionGetEquationOfMotion () const
 
unsigned long GetfNoRHSCalls ()
 
G4int GetNumberOfStateVariables () const
 
G4int GetNumberOfVariables () const
 
G4int IntegrationOrder ()
 
G4int IntegratorOrder () const
 
G4bool IsFSAL () const
 
void NormalisePolarizationVector (G4double vec[12])
 
void NormaliseTangentVector (G4double vec[6])
 
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[])
 
 ~G4SimpleHeum ()
 

Protected Member Functions

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

Private Attributes

G4doubledydxMid
 
G4doubledydxTemp = nullptr
 
G4doubledydxTemp2 = nullptr
 
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
 
G4int fNumberOfVariables = 0
 
G4doubleyInitial
 
G4doubleyMiddle
 
G4doubleyOneStep
 
G4doubleyTemp = nullptr
 
G4doubleyTemp2 = nullptr
 

Detailed Description

Definition at line 44 of file G4SimpleHeum.hh.

Constructor & Destructor Documentation

◆ G4SimpleHeum()

G4SimpleHeum::G4SimpleHeum ( G4EquationOfMotion EqRhs,
G4int  num_variables = 6 
)

Definition at line 38 of file G4SimpleHeum.cc.

39 : G4MagErrorStepper(EqRhs, num_variables),
40 fNumberOfVariables(num_variables)
41{
46}
double G4double
Definition: G4Types.hh:83
G4MagErrorStepper(G4EquationOfMotion *EqRhs, G4int numberOfVariables, G4int numStateVariables=12)
G4double * yTemp2
Definition: G4SimpleHeum.hh:69
G4double * dydxTemp2
Definition: G4SimpleHeum.hh:67
G4int fNumberOfVariables
Definition: G4SimpleHeum.hh:64
G4double * yTemp
Definition: G4SimpleHeum.hh:68
G4double * dydxTemp
Definition: G4SimpleHeum.hh:66

References dydxTemp, dydxTemp2, fNumberOfVariables, yTemp, and yTemp2.

◆ ~G4SimpleHeum()

G4SimpleHeum::~G4SimpleHeum ( )

Definition at line 52 of file G4SimpleHeum.cc.

53{
54 delete [] dydxTemp;
55 delete [] dydxTemp2;
56 delete [] yTemp;
57 delete [] yTemp2;
58}

References dydxTemp, dydxTemp2, yTemp, and yTemp2.

Member Function Documentation

◆ DistChord()

G4double G4MagErrorStepper::DistChord ( ) const
virtualinherited

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}
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
G4ThreeVector fMidPoint
G4ThreeVector fFinalPoint
G4ThreeVector fInitialPoint

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

◆ DumbStepper()

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

Implements G4MagErrorStepper.

Definition at line 65 of file G4SimpleHeum.cc.

69{
70 for( G4int i = 0; i < fNumberOfVariables; ++i )
71 {
72 yTemp[i] = yIn[i] + (1.0/3.0) * h * dydx[i] ;
73 }
74
76
77 for( G4int i = 0; i < fNumberOfVariables; ++i )
78 {
79 yTemp2[i] = yIn[i] + (2.0/3.0) * h * dydxTemp[i] ;
80 }
81
83
84 for( G4int i = 0; i < fNumberOfVariables; ++i )
85 {
86 yOut[i] = yIn[i] + h * (0.25 * dydx[i] + 0.75 * dydxTemp2[i]);
87 }
88
89 if ( fNumberOfVariables == 12 ) { NormalisePolarizationVector( yOut ); }
90}
int G4int
Definition: G4Types.hh:85
void NormalisePolarizationVector(G4double vec[12])
void RightHandSide(const G4double y[], G4double dydx[]) const

References dydxTemp, dydxTemp2, fNumberOfVariables, G4MagIntegratorStepper::NormalisePolarizationVector(), G4MagIntegratorStepper::RightHandSide(), yTemp, and yTemp2.

◆ 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()

G4int G4SimpleHeum::IntegratorOrder ( ) const
inlinevirtual

Implements G4MagIntegratorStepper.

Definition at line 60 of file G4SimpleHeum.hh.

60{ return 3; }

◆ IsFSAL()

G4bool G4MagIntegratorStepper::IsFSAL ( ) const
inlineinherited

◆ NormalisePolarizationVector()

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

◆ NormaliseTangentVector()

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

◆ 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[] 
)
virtualinherited

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
virtual void DumbStepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[])=0
G4int GetNumberOfVariables() const
G4int GetNumberOfStateVariables() const
virtual G4int IntegratorOrder() const =0

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

Field Documentation

◆ dydxMid

G4double * G4MagErrorStepper::dydxMid
privateinherited

◆ dydxTemp

G4double* G4SimpleHeum::dydxTemp = nullptr
private

Definition at line 66 of file G4SimpleHeum.hh.

Referenced by DumbStepper(), G4SimpleHeum(), and ~G4SimpleHeum().

◆ dydxTemp2

G4double* G4SimpleHeum::dydxTemp2 = nullptr
private

Definition at line 67 of file G4SimpleHeum.hh.

Referenced by DumbStepper(), G4SimpleHeum(), and ~G4SimpleHeum().

◆ fEquation_Rhs

G4EquationOfMotion* G4MagIntegratorStepper::fEquation_Rhs = nullptr
privateinherited

Definition at line 124 of file G4MagIntegratorStepper.hh.

◆ fFinalPoint

G4ThreeVector G4MagErrorStepper::fFinalPoint
privateinherited

◆ fInitialPoint

G4ThreeVector G4MagErrorStepper::fInitialPoint
privateinherited

◆ 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
privateinherited

◆ 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.

◆ fNumberOfVariables

G4int G4SimpleHeum::fNumberOfVariables = 0
private

Definition at line 64 of file G4SimpleHeum.hh.

Referenced by DumbStepper(), and G4SimpleHeum().

◆ yInitial

G4double* G4MagErrorStepper::yInitial
privateinherited

◆ yMiddle

G4double * G4MagErrorStepper::yMiddle
privateinherited

◆ yOneStep

G4double * G4MagErrorStepper::yOneStep
privateinherited

◆ yTemp

G4double* G4SimpleHeum::yTemp = nullptr
private

Definition at line 68 of file G4SimpleHeum.hh.

Referenced by DumbStepper(), G4SimpleHeum(), and ~G4SimpleHeum().

◆ yTemp2

G4double* G4SimpleHeum::yTemp2 = nullptr
private

Definition at line 69 of file G4SimpleHeum.hh.

Referenced by DumbStepper(), G4SimpleHeum(), and ~G4SimpleHeum().


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