652 fTimeStep = fMaxTimeStep;
657 fInteractionStep =
false;
658 fReachedUserTimeLimit =
false;
669 G4cout <<
"*** Start Of Step N°" << fNbSteps + 1 <<
" ***" <<
G4endl;
678 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
679 MemStat mem_first, mem_second, mem_diff;
682 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
688 if (fUsePreDefinedTimeSteps)
697 <<
" the chosen user time step is : "
709 fDefinedMinTimeStep);
712 else if(fUseDefaultTimeSteps)
714 fTSTimeStep = fDefinedMinTimeStep;
717 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
719 mem_diff = mem_second-mem_first;
720 G4cout <<
"|| MEM || After computing TS, diff is : " << mem_diff <<
G4endl;
737 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
751 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
753 mem_diff = mem_second-mem_first;
754 G4cout <<
"|| MEM || After IL, diff is : " << mem_diff <<
G4endl;
763 G4cout <<
"*** The minimum time returned by the processes is : "
771 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
775 if (fILTimeStep <= fTSTimeStep)
778 fInteractionStep =
true;
780 fTimeStep = fILTimeStep;
786 fInteractionStep =
false;
788 fTimeStep = fTSTimeStep;
792 if (fGlobalTime + fTimeStep > fStopTime)
795 fTimeStep = fStopTime - fGlobalTime;
797 fInteractionStep =
true;
805 if (fZeroTimeCount >= fMaxNZeroTimeStepsAllowed)
809 exceptionDescription <<
"Too many zero time steps were detected. ";
810 exceptionDescription <<
"The simulation is probably stuck. ";
812 <<
"The maximum number of zero time steps is currently : "
813 << fMaxNZeroTimeStepsAllowed;
814 exceptionDescription <<
".";
817 "SchedulerNullTimeSteps",
819 exceptionDescription);
827 fReachedUserTimeLimit =
828 ((fTimeStep <= fDefinedMinTimeStep) || ((fTimeStep > fDefinedMinTimeStep)
829 && fabs(fTimeStep - fDefinedMinTimeStep) < fTimeTolerance)) ?
835 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
837 mem_diff = mem_second-mem_first;
838 G4cout <<
"|| MEM || After LeadingTracks and UserPreTimeStepAction: "
842 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
847 fGlobalTime += fTimeStep;
852 if (fTSTimeStep > 0 || fILTimeStep <= fTSTimeStep)
855 fpStepProcessor->
DoIt(fTimeStep);
865 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
867 mem_diff = mem_second-mem_first;
868 G4cout <<
"|| MEM || After DoIT, diff is : " << mem_diff <<
G4endl;
871 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
879 fReachedUserTimeLimit,
881 fpUserTimeStepAction,
886 if (fpUserTimeStepAction)
891 fPreviousTimeStep = fTimeStep;
893 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
895 mem_diff = mem_second-mem_first;
896 G4cout <<
"|| MEM || After computing reactions + UserPostTimeStepAction, "
897 "diff is : " << mem_diff <<
G4endl;
911 std::stringstream finalOutput;
913 finalOutput <<
"*** End of step N°" << fNbSteps
914 <<
"\t T_i= " <<
G4BestUnit(fGlobalTime-fTimeStep,
"Time")
916 <<
"\t T_f= " <<
G4BestUnit(fGlobalTime,
"Time")
917 <<
"\t " << interactionType
922 if(fReachedUserTimeLimit)
924 finalOutput <<
"It has also reached the user time limit" <<
G4endl;
926 finalOutput <<
"_______________________________________________________________"
930 G4cout << finalOutput.str();
void PrepareLeadingTracks()
std::ostringstream G4ExceptionDescription
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4double CalculateMinTimeStep(G4double currentGlobalTime, G4double definedMinTimeStep)
virtual void UserPostTimeStepAction()
G4GLOB_DLL std::ostream G4cout
virtual void UserPreTimeStepAction()
void DoIt(double timeStep)
double GetLimitingTimeStep() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double ComputeInteractionLength(double previousTimeStep)
void ComputeTrackReaction(G4ITStepStatus fITStepStatus, G4double fGlobalTime, G4double currentTimeStep, G4double previousTimeStep, G4bool reachedUserTimeLimit, G4double fTimeTolerance, G4UserTimeStepAction *fpUserTimeStepAction, G4int fVerbose)
void GetCollisionType(G4String &interactionType)
void ResetLeadingTracks()
bool GetComputeTimeStep()