138 G4int nstp, i, no_warnings=0;
143 static G4int nStpPr=50;
151 G4bool succeeded =
true, lastStepSucceeded;
155 G4int noFullIntegr=0, noSmallIntegr = 0 ;
167 std::ostringstream message;
168 message <<
"Proposed step is zero; hstep = " << hstep <<
" !";
175 std::ostringstream message;
176 message <<
"Invalid run condition." <<
G4endl 177 <<
"Proposed step is negative; hstep = " << hstep <<
"." <<
G4endl 178 <<
"Requested step cannot be negative! Aborting event.";
188 x1= startCurveLength;
191 if ( (hinitial > 0.0) && (hinitial < hstep)
203 for (i=0;i<nvar;i++) { y[i] = ystart[i]; }
214 for (i=0;i<nvar;i++) { ySubStepStart[i] = y[i]; }
216 yFldTrkStart.SetCurveLength(x);
231 lastStepSucceeded= (hdid == h);
234 PrintStatus( ySubStepStart, xSubStepStart, y, x, h, nstp);
242 G4double dchord_step, dyerr, dyerr_len;
244 yFldTrk.SetCurveLength( x );
246 QuickAdvance( yFldTrk, dydx, h, dchord_step, dyerr_len );
249 yFldTrk.DumpToArray(y);
265 G4cout <<
" dyerr= " << dyerr_len <<
" relative = " << dyerr_len / h
266 <<
" epsilon= " <<
eps <<
" hstep= " << hstep
274 "Integration Step became Zero!");
276 dyerr = dyerr_len / h;
284 lastStepSucceeded= (dyerr<=
eps);
287 if (lastStepSucceeded) { noFullIntegr++; }
288 else { noSmallIntegr++; }
293 if( (dbg>0) && (dbg<=2) && (nstp>nStpPr))
295 if( nstp==nStpPr ) {
G4cout <<
"***** Many steps ****" <<
G4endl; }
297 G4cout <<
"hdid=" << std::setw(12) << hdid <<
" " 298 <<
"hnext=" << std::setw(12) << hnext <<
" " 299 <<
"hstep=" << std::setw(12) << hstep <<
" (requested) " 301 PrintStatus( ystart, x1, y, x, h, (nstp==nStpPr) ? -nstp: nstp);
306 G4double endPointDist= (EndPos-StartPos).mag();
320 <<
" good " << noGoodSteps <<
" current h= " << hdid
322 PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
343 if(std::fabs(hnext) <=
Hmin())
347 if( (x < x2 * (1-
eps) ) &&
348 (std::fabs(hstep) >
Hmin()) )
353 PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
380 G4cout <<
"Warning: G4MagIntegratorDriver::AccurateAdvance" 382 <<
" Integration step 'h' became " 383 << h <<
" due to roundoff. " << G4endl
384 <<
" Calculated as difference of x2= "<< x2 <<
" and x=" << x
385 <<
" Forcing termination of advance." <<
G4endl;
391 }
while ( ((nstp++)<=
fMaxNoSteps) && (x < x2) && (!lastStep) );
397 for (i=0;i<nvar;i++) { yEnd[i] = y[i]; }
417 if( dbg && no_warnings )
419 G4cerr <<
"G4MagIntegratorDriver exit status: no-steps " << nstp <<
G4endl;
void DumpToArray(G4double valArr[ncompSVEC]) const
virtual void ComputeRightHandSide(const G4double y[], G4double dydx[])
CLHEP::Hep3Vector G4ThreeVector
G4MagIntegratorStepper * pIntStepper
void SetCurveLength(G4double nCurve_s)
void WarnTooManyStep(G4double x1start, G4double x2end, G4double xCurrent)
void WarnEndPointTooFar(G4double endPointDist, G4double hStepSize, G4double epsilonRelative, G4int debugFlag)
static const G4double eps
static const double perThousand
void OneGoodStep(G4double ystart[], const G4double dydx[], G4double &x, G4double htry, G4double eps, G4double &hdid, G4double &hnext)
G4GLOB_DLL std::ostream G4cout
void PrintStatus(const G4double *StartArr, G4double xstart, const G4double *CurrentArr, G4double xcurrent, G4double requestStep, G4int subStepNo)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const double perMillion
G4bool QuickAdvance(G4FieldTrack &y_val, const G4double dydx[], G4double hstep, G4double &dchord_step, G4double &dyerr)
void WarnSmallStepSize(G4double hnext, G4double hstep, G4double h, G4double xDone, G4int noSteps)
void LoadFromArray(const G4double valArr[ncompSVEC], G4int noVarsIntegrated)
G4double ComputeNewStepSize(G4double errMaxNorm, G4double hstepCurrent)
G4double fSmallestFraction
G4int fNoInitialSmallSteps
G4GLOB_DLL std::ostream G4cerr
const G4int fNoIntegrationVariables
G4double GetCurveLength() const