Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BogackiShampine23 Class Reference

#include <G4BogackiShampine23.hh>

Inheritance diagram for G4BogackiShampine23:
Collaboration diagram for G4BogackiShampine23:

Public Member Functions

 G4BogackiShampine23 (G4EquationOfMotion *EqRhs, G4int numberOfVariables=6, G4bool primary=true)
 
 ~G4BogackiShampine23 ()
 
void Stepper (const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[])
 
G4double DistChord () const
 
G4int IntegratorOrder () const
 
G4bool isFSAL () const
 
G4doublegetLastDydx ()
 
 G4BogackiShampine23 (const G4BogackiShampine23 &)
 
G4BogackiShampine23operator= (const G4BogackiShampine23 &)
 
- Public Member Functions inherited from G4MagIntegratorStepper
 G4MagIntegratorStepper (G4EquationOfMotion *Equation, G4int numIntegrationVariables, G4int numStateVariables=12, bool isFSAL=false)
 
virtual ~G4MagIntegratorStepper ()
 
virtual void ComputeRightHandSide (const G4double y[], G4double dydx[])
 
void NormaliseTangentVector (G4double vec[6])
 
void NormalisePolarizationVector (G4double vec[12])
 
void RightHandSide (const double y[], double dydx[])
 
G4int GetNumberOfVariables () const
 
G4int GetNumberOfStateVariables () const
 
G4int IntegrationOrder ()
 
G4EquationOfMotionGetEquationOfMotion ()
 
void SetEquationOfMotion (G4EquationOfMotion *newEquation)
 
unsigned long GetfNoRHSCalls ()
 
void ResetfNORHSCalls ()
 
bool IsFSAL ()
 

Additional Inherited Members

- Protected Member Functions inherited from G4MagIntegratorStepper
void SetIntegrationOrder (int order)
 
void SetFSAL (bool flag=true)
 

Detailed Description

Definition at line 50 of file G4BogackiShampine23.hh.

Constructor & Destructor Documentation

G4BogackiShampine23::G4BogackiShampine23 ( G4EquationOfMotion EqRhs,
G4int  numberOfVariables = 6,
G4bool  primary = true 
)

Definition at line 61 of file G4BogackiShampine23.cc.

64  : G4MagIntegratorStepper(EqRhs, noIntegrationVariables),
65  fLastStepLength(0.), fAuxStepper(0)
66 {
67  const G4int numberOfVariables = noIntegrationVariables;
68 
69  ak2 = new G4double[numberOfVariables] ;
70  ak3 = new G4double[numberOfVariables] ;
71  ak4 = new G4double[numberOfVariables] ;
72 
73  pseudoDydx_for_DistChord = new G4double[numberOfVariables];
74 
75  const G4int numStateVars = std::max(noIntegrationVariables,
77 
78  yTemp = new G4double[numberOfVariables] ;
79  yIn = new G4double[numberOfVariables] ;
80 
81  fLastInitialVector = new G4double[numStateVars] ;
82  fLastFinalVector = new G4double[numStateVars] ;
83  fLastDyDx = new G4double[numStateVars];
84 
85  fMidVector = new G4double[numStateVars];
86  fMidError = new G4double[numStateVars];
87  if( primary )
88  {
89  fAuxStepper = new G4BogackiShampine23(EqRhs, numberOfVariables, !primary);
90  }
91 }
static const G4double ak2
G4BogackiShampine23(G4EquationOfMotion *EqRhs, G4int numberOfVariables=6, G4bool primary=true)
int G4int
Definition: G4Types.hh:78
G4MagIntegratorStepper(G4EquationOfMotion *Equation, G4int numIntegrationVariables, G4int numStateVariables=12, bool isFSAL=false)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4int GetNumberOfStateVariables() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4BogackiShampine23::~G4BogackiShampine23 ( )

Definition at line 95 of file G4BogackiShampine23.cc.

96 {
97  delete[] ak2;
98  delete[] ak3;
99  delete[] ak4;
100 
101  delete[] yTemp;
102  delete[] yIn;
103 
104  delete[] fLastInitialVector;
105  delete[] fLastFinalVector;
106  delete[] fLastDyDx;
107  delete[] fMidVector;
108  delete[] fMidError;
109 
110  delete fAuxStepper;
111 }
static const G4double ak2
G4BogackiShampine23::G4BogackiShampine23 ( const G4BogackiShampine23 )

Member Function Documentation

G4double G4BogackiShampine23::DistChord ( ) const
virtual

Implements G4MagIntegratorStepper.

Definition at line 200 of file G4BogackiShampine23.cc.

201 {
202  G4double distLine, distChord;
203  G4ThreeVector initialPoint, finalPoint, midPoint;
204 
205  // Store last initial and final points (they will be overwritten in self-Stepper call!)
206  initialPoint = G4ThreeVector( fLastInitialVector[0],
207  fLastInitialVector[1], fLastInitialVector[2]);
208  finalPoint = G4ThreeVector( fLastFinalVector[0],
209  fLastFinalVector[1], fLastFinalVector[2]);
210 
211  // Do half a step using StepNoErr
212 
213  fAuxStepper->Stepper( fLastInitialVector, fLastDyDx, 0.5 * fLastStepLength,
214  fMidVector, fMidError );
215 
216  midPoint = G4ThreeVector( fMidVector[0], fMidVector[1], fMidVector[2]);
217 
218  // Use stored values of Initial and Endpoint + new Midpoint to evaluate
219  // distance of Chord
220 
221 
222  if (initialPoint != finalPoint)
223  {
224  distLine = G4LineSection::Distline( midPoint, initialPoint, finalPoint );
225  distChord = distLine;
226  }
227  else
228  {
229  distChord = (midPoint-initialPoint).mag();
230  }
231  return distChord;
232 }
CLHEP::Hep3Vector G4ThreeVector
static G4double Distline(const G4ThreeVector &OtherPnt, const G4ThreeVector &LinePntA, const G4ThreeVector &LinePntB)
void Stepper(const G4double y[], const G4double dydx[], G4double h, G4double yout[], G4double yerr[])
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4double* G4BogackiShampine23::getLastDydx ( )
G4int G4BogackiShampine23::IntegratorOrder ( ) const
inlinevirtual

Implements G4MagIntegratorStepper.

Definition at line 70 of file G4BogackiShampine23.hh.

70 { return 2; }
G4bool G4BogackiShampine23::isFSAL ( ) const
inline

Definition at line 71 of file G4BogackiShampine23.hh.

71 { return true; }
G4BogackiShampine23& G4BogackiShampine23::operator= ( const G4BogackiShampine23 )
void G4BogackiShampine23::Stepper ( const G4double  y[],
const G4double  dydx[],
G4double  h,
G4double  yout[],
G4double  yerr[] 
)
virtual

Implements G4MagIntegratorStepper.

Definition at line 128 of file G4BogackiShampine23.cc.

133 {
134 
135  G4int i;
136 
137  const G4double b21 = 0.5 ,
138  b31 = 0. , b32 = 3.0/4.0 ,
139  b41 = 2.0/9.0, b42 = 1.0/3.0 , b43 = 4.0/9.0;
140 
141 
142  const G4double dc1 = b41 - 7.0/24.0 , dc2 = b42 - 1.0/4.0 ,
143  dc3 = b43 - 1.0/3.0 , dc4 = - 0.125 ;
144 
145 
146 
147  // Initialise time to t0, needed when it is not updated by the integration.
148  // [ Note: Only for time dependent fields (usually electric)
149  // is it neccessary to integrate the time.]
150  yOut[7] = yTemp[7] = yIn[7];
151 
152  const G4int numberOfVariables= this->GetNumberOfVariables(); // The number of variables to be integrated over
153 
154  // Saving yInput because yInput and yOut can be aliases for same array
155 
156  for(i=0;i<numberOfVariables;i++)
157  {
158  yIn[i]=yInput[i];
159  }
160  // RightHandSide(yIn, dydx) ; // 1st Step --Not doing, getting passed
161 
162  for(i=0;i<numberOfVariables;i++)
163  {
164  yTemp[i] = yIn[i] + b21*Step*DyDx[i] ;
165  }
166  RightHandSide(yTemp, ak2) ; // 2nd Step
167 
168  for(i=0;i<numberOfVariables;i++)
169  {
170  yTemp[i] = yIn[i] + Step*(b31*DyDx[i] + b32*ak2[i]) ;
171  }
172  RightHandSide(yTemp, ak3) ; // 3rd Step
173 
174  for(i=0;i<numberOfVariables;i++)
175  {
176  yOut[i] = yIn[i] + Step*(b41*DyDx[i] + b42*ak2[i] + b43*ak3[i]) ;
177  }
178  RightHandSide(yOut, ak4) ; // 4th Step
179 
180  for(i=0;i<numberOfVariables;i++)
181  {
182  // yOut[i] = yIn[i] + Step*(c1*DyDx[i]+ c2*ak2[i] + c3*ak3[i] + c4*ak4[i]);
183 
184  yErr[i] = Step*(dc1*DyDx[i] + dc2*ak2[i] + dc3*ak3[i] +
185  dc4*ak4[i] ) ;
186 
187 
188  // Store Input and Final values, for possible use in calculating chord
189  fLastInitialVector[i] = yIn[i] ;
190  fLastFinalVector[i] = yOut[i];
191  fLastDyDx[i] = DyDx[i];
192  }
193  // NormaliseTangentVector( yOut ); // Not wanted
194 
195  fLastStepLength =Step;
196 
197  return ;
198 }
static const G4double ak2
int G4int
Definition: G4Types.hh:78
G4int GetNumberOfVariables() const
Definition: Step.hh:41
void RightHandSide(const double y[], double dydx[])
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:


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