138   G4int nstp, i, no_warnings=0;
 
  143   static G4int nStpPr=50;   
 
  151   G4bool succeeded = 
true, lastStepSucceeded;
 
  155   G4int  noFullIntegr=0, noSmallIntegr = 0 ;
 
  157   const  G4int  nvar= fNoVars;
 
  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]; }
 
  215     yFldTrkStart.LoadFromArray(y, fNoIntegrationVariables);
 
  216     yFldTrkStart.SetCurveLength(x);
 
  227     if( h > fMinimumStep )
 
  231       lastStepSucceeded= (hdid == h);   
 
  234         PrintStatus( ySubStepStart, xSubStepStart, y, x, h,  nstp); 
 
  242       G4double dchord_step, dyerr, dyerr_len;   
 
  243       yFldTrk.LoadFromArray(y, fNoIntegrationVariables); 
 
  244       yFldTrk.SetCurveLength( x );
 
  246       QuickAdvance( yFldTrk, dydx, h, dchord_step, dyerr_len ); 
 
  249       yFldTrk.DumpToArray(y);    
 
  253       if ( dyerr_len > fDyerr_max)  { fDyerr_max= dyerr_len; }
 
  254       fDyerrPos_smTot += dyerr_len;
 
  256       if (nstp<=1)  { fNoInitialSmallSteps++; }
 
  261         if(fNoSmallSteps<2) { 
PrintStatus(ySubStepStart, x1, y, x, h, -nstp); }
 
  262         G4cout << 
"Another sub-min step, no " << fNoSmallSteps 
 
  263                << 
" of " << fNoTotalSteps << 
" this time " << nstp << 
G4endl; 
 
  265         G4cout << 
" dyerr= " << dyerr_len << 
" relative = " << dyerr_len / h 
 
  266                << 
" epsilon= " << 
eps << 
" hstep= " << hstep 
 
  267                << 
" h= " << h << 
" hmin= " << fMinimumStep << 
G4endl;
 
  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(); 
 
  319           G4cerr << 
"  Total steps:  bad " << fNoBadSteps
 
  320                  << 
" good " << noGoodSteps << 
" current h= " << hdid
 
  322           PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);  
 
  335     if( (h < 
eps * hstep) || (h < fSmallestFraction * startCurveLength) )
 
  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) );
 
  399   for (i=0;i<nvar;i++)  { yEnd[i] = y[i]; }
 
  405   if(nstp > fMaxNoSteps)
 
  419   if( dbg && no_warnings )
 
  421     G4cerr << 
"G4MagIntegratorDriver exit status: no-steps " << nstp <<
G4endl;
 
static constexpr double perMillion
 
virtual void ComputeRightHandSide(const G4double y[], G4double dydx[])
 
G4double GetCurveLength() const 
 
CLHEP::Hep3Vector G4ThreeVector
 
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
 
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)
 
G4bool QuickAdvance(G4FieldTrack &y_val, const G4double dydx[], G4double hstep, G4double &dchord_step, G4double &dyerr)
 
void DumpToArray(G4double valArr[ncompSVEC]) const 
 
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)
 
static constexpr double perThousand
 
G4GLOB_DLL std::ostream G4cerr