Geant4  10.02.p03
G4Scheduler Class Reference

#include <G4Scheduler.hh>

Inheritance diagram for G4Scheduler:
Collaboration diagram for G4Scheduler:

Public Member Functions

virtual G4bool Notify (G4ApplicationState requestedState)
 
virtual void RegisterModel (G4VITStepModel *, double)
 
void Initialize ()
 
void ForceReinitialization ()
 
bool IsInitialized ()
 
bool IsRunning ()
 
void Reset ()
 
void Process ()
 
void ClearList ()
 
void SetGun (G4ITGun *)
 
G4ITGunGetGun ()
 
void Stop ()
 
void Clear ()
 
void EndTracking ()
 
void SetEndTime (const double)
 
void SetTimeTolerance (double)
 
double GetTimeTolerance () const
 
void SetMaxZeroTimeAllowed (int)
 
int GetMaxZeroTimeAllowed () const
 
G4ITModelHandlerGetModelHandler ()
 
void SetTimeSteps (std::map< double, double > *)
 
void AddTimeStep (double, double)
 
void SetDefaultTimeStep (double)
 
double GetLimitingTimeStep () const
 
G4int GetNbSteps () const
 
void SetMaxNbSteps (G4int)
 
G4int GetMaxNbSteps () const
 
G4double GetStartTime () const
 
G4double GetEndTime () const
 
virtual G4double GetTimeStep () const
 
G4double GetPreviousTimeStep () const
 
G4double GetGlobalTime () const
 
void SetUserAction (G4UserTimeStepAction *)
 
G4UserTimeStepActionGetUserTimeStepAction () const
 
void UseDefaultTimeSteps (G4bool)
 
G4bool AreDefaultTimeStepsUsed ()
 
G4ITStepStatus GetStatus () const
 
void SetVerbose (int)
 
int GetVerbose () const
 
void WhyDoYouStop ()
 
void SetInteractivity (G4ITTrackingInteractivity *)
 
G4ITTrackingInteractivityGetInteractivity ()
 
virtual size_t GetNTracks ()
 
void GetCollisionType (G4String &interactionType)
 
void AddWatchedTime (double time)
 
double GetNextWatchedTime () const
 
void SetMaxTimeStep (double maxTimeStep)
 
double GetMaxTimeStep () const
 
- Public Member Functions inherited from G4VStateDependent
 G4VStateDependent (G4bool bottom=false)
 
virtual ~G4VStateDependent ()
 
G4int operator== (const G4VStateDependent &right) const
 
G4int operator!= (const G4VStateDependent &right) const
 

Static Public Member Functions

static G4SchedulerInstance ()
 
static void DeleteInstance ()
 
- Static Public Member Functions inherited from G4VScheduler
static G4VSchedulerInstance ()
 

Protected Member Functions

virtual ~G4Scheduler ()
 
void DoProcess ()
 
void SynchronizeTracks ()
 
void Stepping ()
 
void FindUserPreDefinedTimeStep ()
 
bool CanICarryOn ()
 
void PrintWhyDoYouStop ()
 
- Protected Member Functions inherited from G4VScheduler
 G4VScheduler ()
 
virtual ~G4VScheduler ()
 

Private Member Functions

 G4Scheduler ()
 
void Create ()
 
 G4Scheduler (const G4Scheduler &)
 
G4Scheduleroperator= (const G4Scheduler &)
 

Private Attributes

G4SchedulerMessengerfpMessenger
 
int fVerbose
 
bool fWhyDoYouStop
 
bool fInitialized
 
bool fRunning
 
G4bool fContinue
 
int fNbSteps
 
int fMaxSteps
 
G4ITStepStatus fITStepStatus
 
G4bool fUseDefaultTimeSteps
 
double fTimeTolerance
 
double fGlobalTime
 
double fTmpGlobalTime
 
double fStartTime
 
double fStopTime
 
double fEndTime
 
double fPreviousTimeStep
 
int fZeroTimeCount
 
int fMaxNZeroTimeStepsAllowed
 
double fTimeStep
 
double fMaxTimeStep
 
bool fUsePreDefinedTimeSteps
 
double fDefaultMinTimeStep
 
std::map< double, double > * fpUserTimeSteps
 
double fUserUpperTimeLimit
 
double fDefinedMinTimeStep
 
bool fReachedUserTimeLimit
 
std::set< double > fWatchedTimes
 
G4UserTimeStepActionfpUserTimeStepAction
 
G4ITStepProcessorfpStepProcessor
 
G4ITModelProcessorfpModelProcessor
 
G4ITTrackingManagerfpTrackingManager
 
G4ITTrackingInteractivityfpTrackingInteractivity
 
G4ITReactionSetfReactionSet
 
G4ITTrackHolderfTrackContainer
 
G4ITModelHandlerfpModelHandler
 
double fTSTimeStep
 
double fILTimeStep
 
bool fInteractionStep
 
G4ITGunfpGun
 

Static Private Attributes

static G4ThreadLocal G4SchedulerfgScheduler
 

Detailed Description

G4ITStepManager enables to synchronize in time the step of tracks.

Definition at line 94 of file G4Scheduler.hh.

Constructor & Destructor Documentation

◆ ~G4Scheduler()

G4Scheduler::~G4Scheduler ( )
protectedvirtual

Definition at line 201 of file G4Scheduler.cc.

202 {
203 
204  if(fpMessenger) // is used as a flag to know whether the manager was cleared
205  {
206  Clear();
207  }
208 
209  fgScheduler = 0;
210 
211 // if (fVerbose >= 1)
212 // {
213 // G4cout << "G4Scheduler is being deleted. Bye :) !" << G4endl;
214 // }
215 }
static G4ThreadLocal G4Scheduler * fgScheduler
Definition: G4Scheduler.hh:219
void Clear()
Definition: G4Scheduler.cc:217
G4SchedulerMessenger * fpMessenger
Definition: G4Scheduler.hh:217
Here is the call graph for this function:

◆ G4Scheduler() [1/2]

G4Scheduler::G4Scheduler ( )
private

Definition at line 133 of file G4Scheduler.cc.

133  :
136 {
137  Create();
138 }
void Create()
Definition: G4Scheduler.cc:140
static G4ITTrackHolder * Instance()
G4VStateDependent(G4bool bottom=false)
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
Here is the call graph for this function:

◆ G4Scheduler() [2/2]

G4Scheduler::G4Scheduler ( const G4Scheduler )
private

Definition at line 1122 of file G4Scheduler.cc.

1122  :
1125 
1126 {
1127  Create();
1128 }
void Create()
Definition: G4Scheduler.cc:140
static G4ITTrackHolder * Instance()
G4VStateDependent(G4bool bottom=false)
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
Here is the call graph for this function:

Member Function Documentation

◆ AddTimeStep()

void G4Scheduler::AddTimeStep ( double  startingTime,
double  timeStep 
)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 310 of file G4Scheduler.hh.

311 {
312  if (fpUserTimeSteps == 0)
313  {
314  fpUserTimeSteps = new std::map<double, double>();
316  }
317 
318  (*fpUserTimeSteps)[startingTime] = timeStep;
319 }
std::map< double, double > * fpUserTimeSteps
Definition: G4Scheduler.hh:249
bool fUsePreDefinedTimeSteps
Definition: G4Scheduler.hh:247

◆ AddWatchedTime()

void G4Scheduler::AddWatchedTime ( double  time)
inline

Definition at line 181 of file G4Scheduler.hh.

182  {
183  fWatchedTimes.insert(time);
184  }
std::set< double > fWatchedTimes
Definition: G4Scheduler.hh:256

◆ AreDefaultTimeStepsUsed()

G4bool G4Scheduler::AreDefaultTimeStepsUsed ( )
inline

Definition at line 443 of file G4Scheduler.hh.

444 {
445  return (fUseDefaultTimeSteps == false && fUsePreDefinedTimeSteps == false);
446 }
G4bool fUseDefaultTimeSteps
Definition: G4Scheduler.hh:232
bool fUsePreDefinedTimeSteps
Definition: G4Scheduler.hh:247
Here is the caller graph for this function:

◆ CanICarryOn()

bool G4Scheduler::CanICarryOn ( )
protected

Definition at line 549 of file G4Scheduler.cc.

550 {
551  return fGlobalTime < fEndTime && (fMaxSteps == -1 ? true : fNbSteps < fMaxSteps)
552  && fContinue == true;
553 }
double fEndTime
Definition: G4Scheduler.hh:238
G4bool fContinue
Definition: G4Scheduler.hh:224
double fGlobalTime
Definition: G4Scheduler.hh:234
Here is the caller graph for this function:

◆ Clear()

void G4Scheduler::Clear ( )

Definition at line 217 of file G4Scheduler.cc.

218 {
219 // if (fVerbose) G4cout << "*** G4Scheduler is being cleared ***" << G4endl;
220 
221  if(fpMessenger)
222  {
223  delete fpMessenger;
224  fpMessenger = 0;
225  }
226  if(fpStepProcessor)
227  {
228  delete fpStepProcessor;
229  fpStepProcessor = 0;
230  }
231  if(fpModelProcessor)
232  {
233  delete fpModelProcessor;
234  fpModelProcessor = 0;
235  }
236 
238  ClearList();
240  {
241  delete fpTrackingManager;
242  fpTrackingManager = 0;
243  }
244 
245  if(fReactionSet)
246  {
247  delete fReactionSet;
248  fReactionSet = 0;
249  }
250 
251  if(fpModelHandler)
252  {
253  delete fpModelHandler;
254  fpModelHandler = 0;
255  }
256 
257  //* DEBUG
258  //* assert(G4StateManager::GetStateManager()->
259  //* DeregisterDependent(this) == true);
260 
261 }
G4ITReactionSet * fReactionSet
Definition: G4Scheduler.hh:266
static G4ITTypeManager * Instance()
Definition: G4ITType.cc:58
G4ITTrackingManager * fpTrackingManager
Definition: G4Scheduler.hh:264
void ClearList()
Definition: G4Scheduler.cc:265
G4ITModelProcessor * fpModelProcessor
Definition: G4Scheduler.hh:263
G4SchedulerMessenger * fpMessenger
Definition: G4Scheduler.hh:217
G4ITModelHandler * fpModelHandler
Definition: G4Scheduler.hh:268
G4ITStepProcessor * fpStepProcessor
Definition: G4Scheduler.hh:262
void ReleaseRessource()
Definition: G4ITType.cc:83
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClearList()

void G4Scheduler::ClearList ( )

Definition at line 265 of file G4Scheduler.cc.

266 {
267 // if (fNbTracks == 0) return;
268 
270 
272 }
static void DeleteInstance()
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Create()

void G4Scheduler::Create ( )
private

Definition at line 140 of file G4Scheduler.cc.

141 {
142  fUseDefaultTimeSteps = true;
143  fUserUpperTimeLimit = -1;
144  fpGun = 0;
145  fContinue = true;
146 // fpMainList = 0;
147 // fpWaitingList = 0;
149 
151 
152  fpUserTimeSteps = 0;
153 
154  fTimeStep = DBL_MAX;
158 
159  fZeroTimeCount = 0;
161 
162  fStartTime = 0;
164  fEndTime = 1 * microsecond;
165  fGlobalTime = -1;
166  fInteractionStep = true;
167  fUsePreDefinedTimeSteps = false;
168 
170 
171  fpStepProcessor = 0;
172  fpModelProcessor = 0;
173 
174  fNbSteps = 0;
175  fMaxSteps = -1;
176 
177  fRunning = false;
178  fInitialized = false;
179 
183 
184  fVerbose = 0;
185  fWhyDoYouStop = false;
186  fDefinedMinTimeStep = -1.;
187  fReachedUserTimeLimit = false;
188  fStopTime = -1.;
189  fTmpGlobalTime = -1.;
190 
191  fpMessenger = new G4SchedulerMessenger(this);
192 
195 
197 }
G4bool fUseDefaultTimeSteps
Definition: G4Scheduler.hh:232
std::map< double, double > * fpUserTimeSteps
Definition: G4Scheduler.hh:249
G4ITReactionSet * fReactionSet
Definition: G4Scheduler.hh:266
bool fInteractionStep
Definition: G4Scheduler.hh:277
bool fReachedUserTimeLimit
Definition: G4Scheduler.hh:254
double fTSTimeStep
Definition: G4Scheduler.hh:271
double fMaxTimeStep
Definition: G4Scheduler.hh:244
double fPreviousTimeStep
Definition: G4Scheduler.hh:239
double fStopTime
Definition: G4Scheduler.hh:237
G4ITStepStatus fITStepStatus
Definition: G4Scheduler.hh:229
int fMaxNZeroTimeStepsAllowed
Definition: G4Scheduler.hh:241
double fILTimeStep
Definition: G4Scheduler.hh:273
static G4ITTypeManager * Instance()
Definition: G4ITType.cc:58
static G4ITReactionSet * Instance()
G4ITGun * fpGun
Definition: G4Scheduler.hh:281
static const double microsecond
Definition: G4SIunits.hh:159
bool fUsePreDefinedTimeSteps
Definition: G4Scheduler.hh:247
bool fInitialized
Definition: G4Scheduler.hh:222
double fUserUpperTimeLimit
Definition: G4Scheduler.hh:251
G4ITTrackingManager * fpTrackingManager
Definition: G4Scheduler.hh:264
double fEndTime
Definition: G4Scheduler.hh:238
G4ITModelProcessor * fpModelProcessor
Definition: G4Scheduler.hh:263
G4SchedulerMessenger * fpMessenger
Definition: G4Scheduler.hh:217
double fTimeTolerance
Definition: G4Scheduler.hh:233
void ReserveRessource()
Definition: G4ITType.cc:77
G4ITModelHandler * fpModelHandler
Definition: G4Scheduler.hh:268
G4ITStepProcessor * fpStepProcessor
Definition: G4Scheduler.hh:262
double fTimeStep
Definition: G4Scheduler.hh:243
double fStartTime
Definition: G4Scheduler.hh:236
G4ITTrackingInteractivity * fpTrackingInteractivity
Definition: G4Scheduler.hh:265
bool fWhyDoYouStop
Definition: G4Scheduler.hh:221
G4UserTimeStepAction * fpUserTimeStepAction
Definition: G4Scheduler.hh:258
double fDefinedMinTimeStep
Definition: G4Scheduler.hh:252
G4bool fContinue
Definition: G4Scheduler.hh:224
double fDefaultMinTimeStep
Definition: G4Scheduler.hh:248
double fGlobalTime
Definition: G4Scheduler.hh:234
static const double picosecond
Definition: G4SIunits.hh:160
int fZeroTimeCount
Definition: G4Scheduler.hh:240
#define DBL_MAX
Definition: templates.hh:83
double fTmpGlobalTime
Definition: G4Scheduler.hh:235
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeleteInstance()

void G4Scheduler::DeleteInstance ( )
static

DeleteInstance should be used instead of the destructor

Definition at line 124 of file G4Scheduler.cc.

125 {
126  if(fgScheduler)
127  {
128  delete fgScheduler;
129  }
130 }
static G4ThreadLocal G4Scheduler * fgScheduler
Definition: G4Scheduler.hh:219

◆ DoProcess()

void G4Scheduler::DoProcess ( )
protected

Definition at line 601 of file G4Scheduler.cc.

603 {
605 
606 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_STEPPING)
607  MemStat mem_first, mem_second, mem_diff;
608 #endif
609 
610 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_STEPPING)
611  mem_first = MemoryUsage();
612 #endif
613 
614  while (fGlobalTime < fStopTime
616  && (fMaxSteps == -1 ? true : fNbSteps < fMaxSteps)
617  && fContinue == true)
618  {
619 // G4cout << "Mainlist size : " << fTrackContainer.GetMainList()->size()
620 // << G4endl;
621 
622  Stepping();
623 
624 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_STEPPING)
625  mem_second = MemoryUsage();
626  mem_diff = mem_second-mem_first;
627  G4cout << "\t || MEM || After step " << fNbSteps << ", diff is : "
628  << mem_diff << G4endl;
629 #endif
630  }
631 
633 
634 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_STEPPING)
635  mem_second = MemoryUsage();
636  mem_diff = mem_second-mem_first;
637  G4cout << "\t || MEM || After stepping, diff is : " << mem_diff << G4endl;
638 #endif
639 
640 #ifdef G4VERBOSE
641  if(fVerbose > 2)
642  G4cout << "*** G4Scheduler has finished processing a track list at time : "
643  << G4BestUnit(fGlobalTime, "Time") << G4endl;
644 #endif
645 }
void PrintWhyDoYouStop()
Definition: G4Scheduler.cc:557
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
double fStopTime
Definition: G4Scheduler.hh:237
MemStat MemoryUsage()
Definition: G4MemStat.cc:55
G4GLOB_DLL std::ostream G4cout
G4UserTimeStepAction * fpUserTimeStepAction
Definition: G4Scheduler.hh:258
G4bool fContinue
Definition: G4Scheduler.hh:224
#define G4endl
Definition: G4ios.hh:61
double fGlobalTime
Definition: G4Scheduler.hh:234
void Stepping()
Definition: G4Scheduler.cc:648
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EndTracking()

void G4Scheduler::EndTracking ( )

Definition at line 1061 of file G4Scheduler.cc.

1062 {
1063  if(fRunning)
1064  {
1065  G4ExceptionDescription exceptionDescription;
1066  exceptionDescription
1067  << "End tracking is called while G4Scheduler is still running."
1068  << G4endl;
1069 
1070  G4Exception("G4Scheduler::EndTracking",
1071  "Scheduler017",
1073  exceptionDescription);
1074  }
1075 
1077 
1079  {
1081  G4TrackManyList::iterator it = mainList->begin();
1082  G4TrackManyList::iterator end = mainList->end();
1083  for (; it != end; ++it)
1084  {
1086  }
1087  }
1088 
1089  if (fTrackContainer.SecondaryListsNOTEmpty()) // should be empty
1090  {
1092  G4TrackManyList::iterator it = secondaries->begin();
1093  G4TrackManyList::iterator end = secondaries->end();
1094 
1095  for (; it != end; ++it)
1096  {
1098  }
1099  }
1100 }
void MergeSecondariesWithMainList()
G4TrackManyList * GetSecondariesList()
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void EndTrackingWOKill(G4Track *)
G4ITTrackingManager * fpTrackingManager
Definition: G4Scheduler.hh:264
bool SecondaryListsNOTEmpty()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4TrackList * GetMainList(Key)
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindUserPreDefinedTimeStep()

void G4Scheduler::FindUserPreDefinedTimeStep ( )
protected

Definition at line 1006 of file G4Scheduler.cc.

1007 {
1008 
1009  if(fpUserTimeSteps == 0)
1010  {
1011  G4ExceptionDescription exceptionDescription;
1012  exceptionDescription
1013  << "You are asking to use user defined steps but you did not give any.";
1014  G4Exception("G4Scheduler::FindUserPreDefinedTimeStep",
1015  "Scheduler004",
1017  exceptionDescription);
1018  return; // makes coverity happy
1019  }
1020  map<double, double>::iterator fpUserTimeSteps_i =
1021  fpUserTimeSteps->upper_bound(fGlobalTime);
1022  map<double, double>::iterator fpUserTimeSteps_low = fpUserTimeSteps
1023  ->lower_bound(fGlobalTime);
1024 
1025  // DEBUG
1026  // G4cout << "fGlobalTime : " << G4BestUnit(fGlobalTime,"Time") << G4endl;
1027  // G4cout << "fpUserTimeSteps_i : "
1028  // <<"<"<<G4BestUnit(fpUserTimeSteps_i->first,"Time")<<", "
1029  // << G4BestUnit(fpUserTimeSteps_i->second,"Time")<<">"
1030  // << "\t fpUserTimeSteps_low : "
1031  // <<"<"<<G4BestUnit(fpUserTimeSteps_low->first,"Time")<<", "
1032  // << G4BestUnit(fpUserTimeSteps_low->second,"Time")<<">"
1033  // << G4endl;
1034 
1035  if(fpUserTimeSteps_i == fpUserTimeSteps->end())
1036  {
1037  fpUserTimeSteps_i--;
1038  }
1039  else if(fabs(fGlobalTime - fpUserTimeSteps_low->first) < fTimeTolerance)
1040  {
1041  // Case : fGlobalTime = X picosecond
1042  // and fpUserTimeSteps_low->first = X picosecond
1043  // but the precision is not good enough
1044  fpUserTimeSteps_i = fpUserTimeSteps_low;
1045  }
1046  else if(fpUserTimeSteps_i == fpUserTimeSteps_low)
1047  {
1048  // "Normal" cases
1049  fpUserTimeSteps_i--;
1050  }
1051  else
1052  {
1053  fpUserTimeSteps_i = fpUserTimeSteps_low;
1054  }
1055 
1056  fDefinedMinTimeStep = fpUserTimeSteps_i->second;
1057 }
std::map< double, double > * fpUserTimeSteps
Definition: G4Scheduler.hh:249
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
double fTimeTolerance
Definition: G4Scheduler.hh:233
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double fDefinedMinTimeStep
Definition: G4Scheduler.hh:252
double fGlobalTime
Definition: G4Scheduler.hh:234
Here is the call graph for this function:

◆ ForceReinitialization()

void G4Scheduler::ForceReinitialization ( )

Definition at line 1115 of file G4Scheduler.cc.

1116 {
1117  fInitialized = false;
1118  Initialize();
1119 }
bool fInitialized
Definition: G4Scheduler.hh:222
void Initialize()
Definition: G4Scheduler.cc:282
Here is the call graph for this function:

◆ GetCollisionType()

void G4Scheduler::GetCollisionType ( G4String interactionType)

Definition at line 1146 of file G4Scheduler.cc.

1147 {
1148  switch(fITStepStatus)
1149  {
1151  interactionType = "eInteractionWithMedium";
1152  break;
1154  interactionType = "eCollisionBetweenTracks";
1155  break;
1156  default:
1157  interactionType = "eCollisionBetweenTracks";
1158  break;
1159  }
1160 }
G4ITStepStatus fITStepStatus
Definition: G4Scheduler.hh:229
Here is the caller graph for this function:

◆ GetEndTime()

G4double G4Scheduler::GetEndTime ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 341 of file G4Scheduler.hh.

342 {
343  return fEndTime;
344 }
double fEndTime
Definition: G4Scheduler.hh:238
Here is the caller graph for this function:

◆ GetGlobalTime()

G4double G4Scheduler::GetGlobalTime ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 356 of file G4Scheduler.hh.

357 {
358  return fGlobalTime;
359 }
double fGlobalTime
Definition: G4Scheduler.hh:234
Here is the caller graph for this function:

◆ GetGun()

G4ITGun * G4Scheduler::GetGun ( )
inline

Definition at line 428 of file G4Scheduler.hh.

429 {
430  return fpGun;
431 }
G4ITGun * fpGun
Definition: G4Scheduler.hh:281

◆ GetInteractivity()

G4ITTrackingInteractivity * G4Scheduler::GetInteractivity ( )
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 418 of file G4Scheduler.hh.

419 {
421 }
G4ITTrackingInteractivity * fpTrackingInteractivity
Definition: G4Scheduler.hh:265

◆ GetLimitingTimeStep()

double G4Scheduler::GetLimitingTimeStep ( ) const
virtual

Reimplemented from G4VScheduler.

Definition at line 940 of file G4Scheduler.cc.

941 {
942  if (fpUserTimeSteps == 0) return fDefaultMinTimeStep;
944  return fDefinedMinTimeStep;
945 
946  map<double, double>::const_iterator it_fpUserTimeSteps_i = fpUserTimeSteps
947  ->upper_bound(fGlobalTime);
948  map<double, double>::const_iterator it_fpUserTimeSteps_low = fpUserTimeSteps
949  ->lower_bound(fGlobalTime);
950 
951  // DEBUG
952  // G4cout << "fGlobalTime : " << G4BestUnit(fGlobalTime,"Time")
953  // << G4endl;
954  // G4cout << "fpUserTimeSteps_i : "
955  // <<"<"<<G4BestUnit(it_fpUserTimeSteps->first,"Time")
956  // <<", "<< G4BestUnit(it_fpUserTimeSteps->second,"Time")<<">"
957  // << "\t fpUserTimeSteps_low : "
958  // <<"<"<<G4BestUnit(fpUserTimeSteps_low->first,"Time")<<", "*
959  // << G4BestUnit(fpUserTimeSteps_low->second,"Time")<<">"
960  // << G4endl;
961 
962  if (it_fpUserTimeSteps_i == fpUserTimeSteps->end())
963  {
964  it_fpUserTimeSteps_i--;
966  }
967  else if (fabs(fGlobalTime - it_fpUserTimeSteps_low->first) < fTimeTolerance)
968  {
969  // Case : fGlobalTime = X picosecond
970  // and fpUserTimeSteps_low->first = X picosecond
971  // but the precision is not good enough
972  it_fpUserTimeSteps_i = it_fpUserTimeSteps_low;
973  map<double, double>::const_iterator tmp_it = it_fpUserTimeSteps_low;
974  ++tmp_it;
975  if (tmp_it == fpUserTimeSteps->end())
976  {
978  }
979  else
980  {
981  fUserUpperTimeLimit = tmp_it->first;
982  }
983  }
984  else if (it_fpUserTimeSteps_i == it_fpUserTimeSteps_low)
985  {
986  // "Normal" cases
987  fUserUpperTimeLimit = it_fpUserTimeSteps_i->first;
988 // it_fpUserTimeSteps_i++;
989 // G4cout << "Global time = " << fGlobalTime << G4endl;
990 // G4cout << "Is begin = "
991 // << (it_fpUserTimeSteps_i == fpUserTimeSteps->begin())<< G4endl;
992 
993  if(it_fpUserTimeSteps_i != fpUserTimeSteps->begin()) it_fpUserTimeSteps_i--;
994  }
995  else
996  {
997  fUserUpperTimeLimit = it_fpUserTimeSteps_i->first;
998  it_fpUserTimeSteps_i = it_fpUserTimeSteps_low;
999  }
1000 
1001  return it_fpUserTimeSteps_i->second;
1002 }
std::map< double, double > * fpUserTimeSteps
Definition: G4Scheduler.hh:249
double fStopTime
Definition: G4Scheduler.hh:237
double fUserUpperTimeLimit
Definition: G4Scheduler.hh:251
double fTimeTolerance
Definition: G4Scheduler.hh:233
double fDefinedMinTimeStep
Definition: G4Scheduler.hh:252
double fDefaultMinTimeStep
Definition: G4Scheduler.hh:248
double fGlobalTime
Definition: G4Scheduler.hh:234
Here is the caller graph for this function:

◆ GetMaxNbSteps()

G4int G4Scheduler::GetMaxNbSteps ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 331 of file G4Scheduler.hh.

332 {
333  return fMaxSteps;
334 }
Here is the caller graph for this function:

◆ GetMaxTimeStep()

double G4Scheduler::GetMaxTimeStep ( ) const
inline

Definition at line 194 of file G4Scheduler.hh.

195  {
196  return fMaxTimeStep;
197  }
double fMaxTimeStep
Definition: G4Scheduler.hh:244

◆ GetMaxZeroTimeAllowed()

int G4Scheduler::GetMaxZeroTimeAllowed ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 388 of file G4Scheduler.hh.

389 {
391 }
int fMaxNZeroTimeStepsAllowed
Definition: G4Scheduler.hh:241
Here is the caller graph for this function:

◆ GetModelHandler()

G4ITModelHandler * G4Scheduler::GetModelHandler ( )
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 293 of file G4Scheduler.hh.

294 {
295  return fpModelHandler;
296 }
G4ITModelHandler * fpModelHandler
Definition: G4Scheduler.hh:268

◆ GetNbSteps()

G4int G4Scheduler::GetNbSteps ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 321 of file G4Scheduler.hh.

322 {
323  return fNbSteps;
324 }

◆ GetNextWatchedTime()

double G4Scheduler::GetNextWatchedTime ( ) const

Definition at line 487 of file G4Scheduler.cc.

488 {
489  std::set<double>::const_iterator up = fWatchedTimes.upper_bound(fGlobalTime);
490  if(up == fWatchedTimes.end()) return DBL_MAX;
491  return *up;
492 }
std::set< double > fWatchedTimes
Definition: G4Scheduler.hh:256
double fGlobalTime
Definition: G4Scheduler.hh:234
#define DBL_MAX
Definition: templates.hh:83
Here is the caller graph for this function:

◆ GetNTracks()

size_t G4Scheduler::GetNTracks ( )
virtual

Definition at line 1140 of file G4Scheduler.cc.

1141 {
1142  return fTrackContainer.GetNTracks();
1143 }
virtual size_t GetNTracks()
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
Here is the call graph for this function:

◆ GetPreviousTimeStep()

G4double G4Scheduler::GetPreviousTimeStep ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 403 of file G4Scheduler.hh.

404 {
405  return fPreviousTimeStep;
406 }
double fPreviousTimeStep
Definition: G4Scheduler.hh:239

◆ GetStartTime()

G4double G4Scheduler::GetStartTime ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 336 of file G4Scheduler.hh.

337 {
338  return fStartTime;
339 }
double fStartTime
Definition: G4Scheduler.hh:236

◆ GetStatus()

G4ITStepStatus G4Scheduler::GetStatus ( ) const
inline

Definition at line 408 of file G4Scheduler.hh.

409 {
410  return fITStepStatus;
411 }
G4ITStepStatus fITStepStatus
Definition: G4Scheduler.hh:229

◆ GetTimeStep()

G4double G4Scheduler::GetTimeStep ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 346 of file G4Scheduler.hh.

347 {
348  return fTimeStep;
349 }
double fTimeStep
Definition: G4Scheduler.hh:243

◆ GetTimeTolerance()

double G4Scheduler::GetTimeTolerance ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 398 of file G4Scheduler.hh.

399 {
400  return fTimeTolerance;
401 }
double fTimeTolerance
Definition: G4Scheduler.hh:233
Here is the caller graph for this function:

◆ GetUserTimeStepAction()

G4UserTimeStepAction * G4Scheduler::GetUserTimeStepAction ( ) const
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 367 of file G4Scheduler.hh.

368 {
369  return fpUserTimeStepAction;
370 }
G4UserTimeStepAction * fpUserTimeStepAction
Definition: G4Scheduler.hh:258

◆ GetVerbose()

int G4Scheduler::GetVerbose ( ) const
inline

Definition at line 377 of file G4Scheduler.hh.

378 {
379  return fVerbose;
380 }
Here is the caller graph for this function:

◆ Initialize()

void G4Scheduler::Initialize ( )
virtual

Reimplemented from G4VScheduler.

Definition at line 282 of file G4Scheduler.cc.

283 {
284  if(fpStepProcessor)
285  {
286  delete fpStepProcessor;
287  }
288  if(fpModelProcessor)
289  {
290  delete fpModelProcessor;
291  }
292  // if(fpMasterModelProcessor)
293  // {
294  // delete fpMasterModelProcessor;
295  // }
296 
297  //______________________________________________________________
298 
302 
303  // fpMasterModelProcessor = new G4ITModelProcessor();
304  // fpMasterModelProcessor->SetModelHandler(fpModelHandler);
305  // fpModelProcessor = fpMasterModelProcessor;
306 
307  //______________________________________________________________
308 
311 
313 
314  // fpMasterStepProcessor = new G4ITStepProcessor();
315  // fpMasterStepProcessor->SetTrackingManager(fpTrackingManager);
316  // fpStepProcessor = fpMasterStepProcessor ;
317  //______________________________________________________________
318 
320  {
321  if(fpUserTimeSteps == 0) // Extra checking, is it necessary ?
322  {
323  G4ExceptionDescription exceptionDescription;
324  exceptionDescription
325  << "You are asking to use user defined steps but you did not give any.";
326  G4Exception("G4Scheduler::FindUserPreDefinedTimeStep",
327  "Scheduler004",
329  exceptionDescription);
330  return; // makes coverity happy
331  }
332  }
333 
334 // if (fComputeTimeStep)
335 // {
336 // if (fpModelProcessor == 0)
337 // {
338 // G4ExceptionDescription exceptionDescription;
339 // exceptionDescription
340 // << "There is no G4ITModelProcessor to handle IT reaction. ";
341 // exceptionDescription
342 // << "You probably did not initialize the G4Scheduler. ";
343 // exceptionDescription
344 // << "Just do G4Scheduler::Instance()->Initialize(); ";
345 // exceptionDescription << " but only after initializing the run manager.";
346 // G4Exception("G4Scheduler::CalculateMinStep", "ITScheduler005",
347 // FatalErrorInArgument, exceptionDescription);
348 // return; // makes coverity happy
349 // }
350 // }
351 
352  fInitialized = true;
353 }
std::map< double, double > * fpUserTimeSteps
Definition: G4Scheduler.hh:249
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void SetTrackingManager(G4ITTrackingManager *trackingManager)
void SetTrackingManager(G4ITTrackingManager *trackMan)
bool fUsePreDefinedTimeSteps
Definition: G4Scheduler.hh:247
bool fInitialized
Definition: G4Scheduler.hh:222
G4ITTrackingManager * fpTrackingManager
Definition: G4Scheduler.hh:264
G4ITModelProcessor * fpModelProcessor
Definition: G4Scheduler.hh:263
G4ITModelHandler * fpModelHandler
Definition: G4Scheduler.hh:268
G4ITStepProcessor * fpStepProcessor
Definition: G4Scheduler.hh:262
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4ITTrackingInteractivity * fpTrackingInteractivity
Definition: G4Scheduler.hh:265
void SetModelHandler(G4ITModelHandler *)
void SetInteractivity(G4ITTrackingInteractivity *)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

G4Scheduler * G4Scheduler::Instance ( void  )
static

Definition at line 102 of file G4Scheduler.cc.

103 {
104  if(fgScheduler == 0) fgScheduler = new G4Scheduler();
105  return fgScheduler;
106 }
static G4ThreadLocal G4Scheduler * fgScheduler
Definition: G4Scheduler.hh:219
Here is the caller graph for this function:

◆ IsInitialized()

bool G4Scheduler::IsInitialized ( )
inline

Definition at line 288 of file G4Scheduler.hh.

289 {
290  return fInitialized;
291 }
bool fInitialized
Definition: G4Scheduler.hh:222
Here is the caller graph for this function:

◆ IsRunning()

bool G4Scheduler::IsRunning ( )
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 114 of file G4Scheduler.hh.

114 {return fRunning;}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Notify()

G4bool G4Scheduler::Notify ( G4ApplicationState  requestedState)
virtual

Implements G4VStateDependent.

Definition at line 109 of file G4Scheduler.cc.

110 {
111  if(requestedState == G4State_Quit)
112  {
113  if(fVerbose >= 4)
114  {
115  G4cout << "G4Scheduler received G4State_Quit" << G4endl;
116  }
117  Clear();
118  //DeleteInstance();
119  }
120  return true;
121 }
G4GLOB_DLL std::ostream G4cout
void Clear()
Definition: G4Scheduler.cc:217
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ operator=()

G4Scheduler & G4Scheduler::operator= ( const G4Scheduler right)
private

Definition at line 1131 of file G4Scheduler.cc.

1132 {
1133  if(this != &right)
1134  {
1135  Create();
1136  }
1137  return *this;
1138 }
void Create()
Definition: G4Scheduler.cc:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintWhyDoYouStop()

void G4Scheduler::PrintWhyDoYouStop ( )
protected

Definition at line 557 of file G4Scheduler.cc.

558 {
559 #ifdef G4VERBOSE
560  if(fWhyDoYouStop)
561  {
562  G4cout << "G4Scheduler has reached a stage: it might be"
563  " a transition or the end"
564  << G4endl;
565 
566  G4bool normalStop = false;
567 
568  if(fGlobalTime >= fStopTime)
569  {
570  G4cout << "== G4Scheduler: I stop because I reached the stop time : "
571  << G4BestUnit(fStopTime,"Time") << " =="<< G4endl;
572  normalStop = true;
573  }
574  if(fTrackContainer.MainListsNOTEmpty() == false) // is empty
575  {
576  G4cout << "G4Scheduler: I stop because the current main list of tracks "
577  "is empty"
578  << G4endl;
579  normalStop = true;
580  }
581  if(fMaxSteps == -1 ? false : fNbSteps >= fMaxSteps)
582  {
583  G4cout << "G4Scheduler: I stop because I reached the maximum allowed "
584  "number of steps=" << fMaxSteps
585  << G4endl;
586  normalStop = true;
587  }
588  if(fContinue && normalStop == false)
589  {
590  G4cout << "G4Scheduler: It might be that I stop because "
591  "I have been told so. You may check "
592  "member fContinue and usage of the method G4Scheduler::Stop()."
593  << G4endl;
594  }
595  }
596 #endif
597 }
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
double fStopTime
Definition: G4Scheduler.hh:237
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
bool fWhyDoYouStop
Definition: G4Scheduler.hh:221
G4bool fContinue
Definition: G4Scheduler.hh:224
#define G4endl
Definition: G4ios.hh:61
double fGlobalTime
Definition: G4Scheduler.hh:234
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Process()

void G4Scheduler::Process ( )
virtual

Reimplemented from G4VScheduler.

Definition at line 377 of file G4Scheduler.cc.

378 {
379 
380 #ifdef G4VERBOSE
381  if(fVerbose)
382  {
383  G4cout << "*** G4Scheduler starts processing " << G4endl;
384  if(fVerbose > 2)
385  G4cout << "___________________________________________"
386  "___________________________" << G4endl;
387  }
388 #endif
389 
390  if (fInitialized == false) Initialize();
391 
392  // fpTrackingManager->Initialize();
395 
396  // TODO
397  // fpMasterModelProcessor->Initialize();
398  // fpMasterStepProcessor->Initialize();
399 
400  if (fpGun) fpGun->DefineTracks();
401 
403 
404  // ___________________
405  fRunning = true;
406  Reset();
407 
409 
410 #ifdef G4VERBOSE
411  G4bool trackFound = false;
412 #endif
413 
414  //===========================================================================
415  // By default, before the G4Scheduler is launched, the tracks are pushed to
416  // the delayed lists
417  //===========================================================================
418 
420  {
422 #ifdef G4VERBOSE
423  trackFound = true;
424  G4Timer localtimer;
425  if(fVerbose>1)
426  {
427  localtimer.Start();
428  }
429 #endif
431 #ifdef G4VERBOSE
432  if(fVerbose>1)
433  {
434  localtimer.Stop();
435  G4cout << "G4Scheduler: process time= "<< localtimer << G4endl;
436  }
437 #endif
438  }
439 
440 // //---------------------------------
441 // // TODO: This could be removed ?
442 // if(fTrackContainer.MainListsNOTEmpty()
443 // && (fMaxSteps == -1 ? true : fNbSteps < fMaxSteps)
444 // && fGlobalTime < fEndTime
445 // && fContinue == true)
446 //{
447 //#ifdef G4VERBOSE
448 // trackFound = true;
449 //#endif
450 // DoProcess();
451 //}
452 // //---------------------------------
453 
454 #ifdef G4VERBOSE
455  if(fVerbose)
456  {
457  if(trackFound)
458  {
459  G4cout << "*** G4Scheduler ends at time : "
460  << G4BestUnit(fGlobalTime,"Time") << G4endl;
461  G4cout << "___________________________________" << G4endl;
462  }
463  else
464  {
465  G4cout << "*** G4Scheduler did not start because no "
466  "track was found to be processed"<< G4endl;
467  G4cout << "___________________________________" << G4endl;
468  }
469  }
470 #endif
471 
472  fRunning = false;
473 
475 
476  // ___________________
477  EndTracking();
478  ClearList();
479 
480  Reset();
481 
483 }
virtual void DefineTracks()
Definition: G4ITGun.hh:56
void EndTracking()
void SynchronizeTracks()
Definition: G4Scheduler.cc:496
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4ITGun * fpGun
Definition: G4Scheduler.hh:281
bool fInitialized
Definition: G4Scheduler.hh:222
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void ClearList()
Definition: G4Scheduler.cc:265
G4ITModelProcessor * fpModelProcessor
Definition: G4Scheduler.hh:263
G4ITStepProcessor * fpStepProcessor
Definition: G4Scheduler.hh:262
virtual void Initialize()
double fStartTime
Definition: G4Scheduler.hh:236
G4ITTrackingInteractivity * fpTrackingInteractivity
Definition: G4Scheduler.hh:265
G4UserTimeStepAction * fpUserTimeStepAction
Definition: G4Scheduler.hh:258
void Stop()
void Reset()
Definition: G4Scheduler.cc:357
#define G4endl
Definition: G4ios.hh:61
double fGlobalTime
Definition: G4Scheduler.hh:234
void Start()
void Initialize()
Definition: G4Scheduler.cc:282
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
virtual void StartProcessing()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterModel()

void G4Scheduler::RegisterModel ( G4VITStepModel model,
double  time 
)
virtual

Reimplemented from G4VScheduler.

Definition at line 275 of file G4Scheduler.cc.

276 {
278 }
void RegisterModel(G4VITStepModel *aModel, const G4double globalTime)
G4ITModelHandler * fpModelHandler
Definition: G4Scheduler.hh:268
Here is the call graph for this function:

◆ Reset()

void G4Scheduler::Reset ( )
virtual

Reimplemented from G4VScheduler.

Definition at line 357 of file G4Scheduler.cc.

358 {
359  fStartTime = 0;
360  fUserUpperTimeLimit = -1;
361  fTimeStep = DBL_MAX;
365  fGlobalTime = -1;
366  fInteractionStep = true;
368  fZeroTimeCount = 0;
369 
370  fNbSteps = 0;
371  fContinue = true;
372  // fReactingTracks.clear();
374 }
G4ITReactionSet * fReactionSet
Definition: G4Scheduler.hh:266
bool fInteractionStep
Definition: G4Scheduler.hh:277
double fTSTimeStep
Definition: G4Scheduler.hh:271
double fPreviousTimeStep
Definition: G4Scheduler.hh:239
G4ITStepStatus fITStepStatus
Definition: G4Scheduler.hh:229
double fILTimeStep
Definition: G4Scheduler.hh:273
double fUserUpperTimeLimit
Definition: G4Scheduler.hh:251
double fTimeStep
Definition: G4Scheduler.hh:243
double fStartTime
Definition: G4Scheduler.hh:236
void CleanAllReaction()
G4bool fContinue
Definition: G4Scheduler.hh:224
double fGlobalTime
Definition: G4Scheduler.hh:234
int fZeroTimeCount
Definition: G4Scheduler.hh:240
#define DBL_MAX
Definition: templates.hh:83
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetDefaultTimeStep()

void G4Scheduler::SetDefaultTimeStep ( double  timeStep)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 351 of file G4Scheduler.hh.

352 {
353  fDefaultMinTimeStep = timeStep;
354 }
double fDefaultMinTimeStep
Definition: G4Scheduler.hh:248

◆ SetEndTime()

void G4Scheduler::SetEndTime ( const double  __endtime)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 298 of file G4Scheduler.hh.

299 {
300  fEndTime = __endtime;
301 }
double fEndTime
Definition: G4Scheduler.hh:238
Here is the caller graph for this function:

◆ SetGun()

void G4Scheduler::SetGun ( G4ITGun gun)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 423 of file G4Scheduler.hh.

424 {
425  fpGun = gun;
426 }
G4ITGun * fpGun
Definition: G4Scheduler.hh:281
Here is the caller graph for this function:

◆ SetInteractivity()

void G4Scheduler::SetInteractivity ( G4ITTrackingInteractivity interactivity)
virtual

Reimplemented from G4VScheduler.

Definition at line 1103 of file G4Scheduler.cc.

1104 {
1105  fpTrackingInteractivity = interactivity;
1106  if(fpTrackingManager)
1107  {
1109  }
1110 
1111  //G4MIWorkspace::GetWorldWorkspace()->SetTrackingInteractivity(interactivity);
1112 }
G4ITTrackingManager * fpTrackingManager
Definition: G4Scheduler.hh:264
G4ITTrackingInteractivity * fpTrackingInteractivity
Definition: G4Scheduler.hh:265
void SetInteractivity(G4ITTrackingInteractivity *)
Here is the call graph for this function:

◆ SetMaxNbSteps()

void G4Scheduler::SetMaxNbSteps ( G4int  maxSteps)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 326 of file G4Scheduler.hh.

327 {
328  fMaxSteps = maxSteps;
329 }
Here is the caller graph for this function:

◆ SetMaxTimeStep()

void G4Scheduler::SetMaxTimeStep ( double  maxTimeStep)
inline

Definition at line 188 of file G4Scheduler.hh.

189  {
190  fMaxTimeStep = maxTimeStep;
191  }
double fMaxTimeStep
Definition: G4Scheduler.hh:244

◆ SetMaxZeroTimeAllowed()

void G4Scheduler::SetMaxZeroTimeAllowed ( int  maxTimeStepAllowed)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 383 of file G4Scheduler.hh.

384 {
385  fMaxNZeroTimeStepsAllowed = maxTimeStepAllowed;
386 }
int fMaxNZeroTimeStepsAllowed
Definition: G4Scheduler.hh:241
Here is the caller graph for this function:

◆ SetTimeSteps()

void G4Scheduler::SetTimeSteps ( std::map< double, double > *  steps)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 304 of file G4Scheduler.hh.

305 {
307  fpUserTimeSteps = steps;
308 }
std::map< double, double > * fpUserTimeSteps
Definition: G4Scheduler.hh:249
bool fUsePreDefinedTimeSteps
Definition: G4Scheduler.hh:247

◆ SetTimeTolerance()

void G4Scheduler::SetTimeTolerance ( double  time)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 393 of file G4Scheduler.hh.

394 {
396 }
double fTimeTolerance
Definition: G4Scheduler.hh:233
Here is the caller graph for this function:

◆ SetUserAction()

void G4Scheduler::SetUserAction ( G4UserTimeStepAction userITAction)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 362 of file G4Scheduler.hh.

363 {
364  fpUserTimeStepAction = userITAction;
365 }
G4UserTimeStepAction * fpUserTimeStepAction
Definition: G4Scheduler.hh:258

◆ SetVerbose()

void G4Scheduler::SetVerbose ( int  verbose)
inlinevirtual

Reimplemented from G4VScheduler.

Definition at line 372 of file G4Scheduler.hh.

373 {
374  fVerbose = verbose;
375 }
Here is the caller graph for this function:

◆ Stepping()

void G4Scheduler::Stepping ( )
protected

Definition at line 648 of file G4Scheduler.cc.

649 {
650  G4IosFlagsSaver iosfs(G4cout);
652 
655 
656  fInteractionStep = false;
657  fReachedUserTimeLimit = false;
658 
660 
661  // Start of step
662 #ifdef G4VERBOSE
663  if (fVerbose > 2)
664  {
665 #ifdef USE_COLOR
666  G4cout << LIGHT_RED;
667 #endif
668  G4cout << "*** Start Of Step N°" << fNbSteps + 1 << " ***" << G4endl;
669  G4cout << "Current Global time : " << G4BestUnit(fGlobalTime, "Time")
670  <<G4endl;
671 #ifdef USE_COLOR
672  G4cout << RESET_COLOR;
673 #endif
674  }
675 #endif
676 
677 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
678  MemStat mem_first, mem_second, mem_diff;
679 #endif
680 
681 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
682  mem_first = MemoryUsage();
683 #endif
684 
686 
688  {
689 #ifdef G4VERBOSE
690  if (fVerbose > 2)
691  {
692 #ifdef USE_COLOR
693  G4cout << LIGHT_RED;
694 #endif
695  G4cout << "*** At time : " << G4BestUnit(fGlobalTime, "Time")
696  << " the chosen user time step is : "
697  << G4BestUnit(fDefinedMinTimeStep, "Time") << " ***" << G4endl;
698 #ifdef USE_COLOR
699  G4cout << RESET_COLOR;
700 #endif
701  }
702 #endif
703  }
704 
705  if (fpModelProcessor->GetComputeTimeStep()) // fComputeTimeStep)
706  {
709  // => at least N (N = nb of tracks) loops
710  }
711  else if(fUseDefaultTimeSteps)
712  {
714  }
715 
716 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
717  mem_second = MemoryUsage();
718  mem_diff = mem_second-mem_first;
719  G4cout << "|| MEM || After computing TS, diff is : " << mem_diff << G4endl;
720 #endif
721 
722 #ifdef G4VERBOSE
723  if (fVerbose > 2)
724  {
725 #ifdef USE_COLOR
726  G4cout << LIGHT_RED;
727 #endif
728  G4cout << "*** Time stepper returned : " << G4BestUnit(fTSTimeStep, "Time")
729  << " ***" << G4endl;
730 #ifdef USE_COLOR
731  G4cout << RESET_COLOR;
732 #endif
733  }
734 #endif
735 
736 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
737  mem_first = MemoryUsage();
738 #endif
739 
740  // Call IL even if fTSTimeStep == 0
741  // if fILTimeStep == 0 give the priority to DoIt processes
742 
743  fILTimeStep =
745  // => at least N loops
746  // All process returns the physical step of interaction
747  // The transportation process calculates the corresponding
748  // time step
749 
750 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
751  mem_second = MemoryUsage();
752  mem_diff = mem_second-mem_first;
753  G4cout << "|| MEM || After IL, diff is : " << mem_diff << G4endl;
754 #endif
755 
756 #ifdef G4VERBOSE
757  if (fVerbose > 2)
758  {
759 #ifdef USE_COLOR
760  G4cout << LIGHT_RED;
761 #endif
762  G4cout << "*** The minimum time returned by the processes is : "
763  << G4BestUnit(fILTimeStep, "Time") << " ***" << G4endl;
764 #ifdef USE_COLOR
765  G4cout << RESET_COLOR;
766 #endif
767  }
768 #endif
769 
770 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
771  mem_first = MemoryUsage();
772 #endif
773 
774  if (fILTimeStep <= fTSTimeStep)
775  // Give the priority to the IL
776  {
777  fInteractionStep = true;
782  }
783  else
784  {
785  fInteractionStep = false;
789  }
790 
792  // This check is done at every time step
793  {
795  fITStepStatus = eInteractionWithMedium; // ie: transportation
796  fInteractionStep = true;
799  }
800 
801  if (fTimeStep == 0) // < fTimeTolerance)
802  {
803  ++fZeroTimeCount;
805  {
806  G4ExceptionDescription exceptionDescription;
807 
808  exceptionDescription << "Too many zero time steps were detected. ";
809  exceptionDescription << "The simulation is probably stuck. ";
810  exceptionDescription
811  << "The maximum number of zero time steps is currently : "
813  exceptionDescription << ".";
814 
815  G4Exception("G4Scheduler::Stepping",
816  "SchedulerNullTimeSteps",
818  exceptionDescription);
819  }
820  }
821  else
822  {
823  fZeroTimeCount = 0;
824  }
825 
827  ((fTimeStep <= fDefinedMinTimeStep) || ((fTimeStep > fDefinedMinTimeStep)
829  true : false;
830 
832  // TODO: pre/post
833 
834 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
835  mem_second = MemoryUsage();
836  mem_diff = mem_second-mem_first;
837  G4cout << "|| MEM || After LeadingTracks and UserPreTimeStepAction: "
838  << mem_diff << G4endl;
839 #endif
840 
841 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
842  mem_first = MemoryUsage();
843 #endif
844 
845 
846  fGlobalTime += fTimeStep;
847 
848  // if fTSTimeStep > 0 => still need to call the transportation process
849  // if fILTimeStep < fTSTimeStep => call only DoIt processes, no reactions
850  // if fILTimeStep == fTSTimeStep => give the priority to the DoIt processes
851  if (fTSTimeStep > 0 || fILTimeStep <= fTSTimeStep)
852  {
853  // G4cout << "Will call DoIT" << G4endl;
855  // fTrackContainer.MergeSecondariesWithMainList();
856  // fTrackContainer.KillTracks(); // remove ?
857  }
858  // else
859  // {
860  // G4cout << "fTSTimeStep : " << fTSTimeStep << G4endl;
861  // G4cout << "fILTimeStep : " << fILTimeStep << G4endl;
862  // }
863 
864 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
865  mem_second = MemoryUsage();
866  mem_diff = mem_second-mem_first;
867  G4cout << "|| MEM || After DoIT, diff is : " << mem_diff << G4endl;
868 #endif
869 
870 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
871  mem_first = MemoryUsage();
872 #endif
873 
875  fGlobalTime,
876  fTimeStep,
881  fVerbose);
882 
883  ++fNbSteps;
884 
886  {
888  }
889 
891 
892 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
893  mem_second = MemoryUsage();
894  mem_diff = mem_second-mem_first;
895  G4cout << "|| MEM || After computing reactions + UserPostTimeStepAction, "
896  "diff is : " << mem_diff << G4endl;
897 #endif
898 
899  // End of step
900 #ifdef G4VERBOSE
901  if (fVerbose >= 2)
902  {
903 #ifdef USE_COLOR
904  G4cout << LIGHT_RED;
905 #endif
906 
907  G4String interactionType;
908  GetCollisionType(interactionType);
909 
910  std::stringstream finalOutput;
911 
912  finalOutput << "*** End of step N°" << fNbSteps
913  << "\t T_i= " << G4BestUnit(fGlobalTime-fTimeStep, "Time")
914  << "\t dt= " << G4BestUnit(fTimeStep, "Time")
915  << "\t T_f= " << G4BestUnit(fGlobalTime, "Time")
916  << "\t " << interactionType
917  << G4endl;
918 
919  if(fVerbose>2)
920  {
922  {
923  finalOutput << "It has also reached the user time limit" << G4endl;
924  }
925  finalOutput << "_______________________________________________________________"
926  "_______"<< G4endl;
927  }
928 
929  G4cout << finalOutput.str();
930 
931 #ifdef USE_COLOR
932  G4cout << RESET_COLOR;
933 #endif
934  }
935 #endif
936 
937 }
G4bool fUseDefaultTimeSteps
Definition: G4Scheduler.hh:232
G4ITReactionSet * fReactionSet
Definition: G4Scheduler.hh:266
bool fInteractionStep
Definition: G4Scheduler.hh:277
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
bool fReachedUserTimeLimit
Definition: G4Scheduler.hh:254
double GetLimitingTimeStep() const
Definition: G4Scheduler.cc:940
double fTSTimeStep
Definition: G4Scheduler.hh:271
double fMaxTimeStep
Definition: G4Scheduler.hh:244
double fPreviousTimeStep
Definition: G4Scheduler.hh:239
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
double fStopTime
Definition: G4Scheduler.hh:237
G4ITStepStatus fITStepStatus
Definition: G4Scheduler.hh:229
int fMaxNZeroTimeStepsAllowed
Definition: G4Scheduler.hh:241
double fILTimeStep
Definition: G4Scheduler.hh:273
MemStat MemoryUsage()
Definition: G4MemStat.cc:55
G4double CalculateMinTimeStep(G4double currentGlobalTime, G4double definedMinTimeStep)
bool fUsePreDefinedTimeSteps
Definition: G4Scheduler.hh:247
virtual void UserPostTimeStepAction()
G4GLOB_DLL std::ostream G4cout
#define RESET_COLOR
Definition: G4Scheduler.cc:87
virtual void UserPreTimeStepAction()
void DoIt(double timeStep)
G4ITModelProcessor * fpModelProcessor
Definition: G4Scheduler.hh:263
double fTimeTolerance
Definition: G4Scheduler.hh:233
G4ITStepProcessor * fpStepProcessor
Definition: G4Scheduler.hh:262
double fTimeStep
Definition: G4Scheduler.hh:243
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double ComputeInteractionLength(double previousTimeStep)
G4UserTimeStepAction * fpUserTimeStepAction
Definition: G4Scheduler.hh:258
void CleanAllReaction()
double fDefinedMinTimeStep
Definition: G4Scheduler.hh:252
void ComputeTrackReaction(G4ITStepStatus fITStepStatus, G4double fGlobalTime, G4double currentTimeStep, G4double previousTimeStep, G4bool reachedUserTimeLimit, G4double fTimeTolerance, G4UserTimeStepAction *fpUserTimeStepAction, G4int fVerbose)
#define G4endl
Definition: G4ios.hh:61
double fGlobalTime
Definition: G4Scheduler.hh:234
void GetCollisionType(G4String &interactionType)
int fZeroTimeCount
Definition: G4Scheduler.hh:240
#define DBL_MAX
Definition: templates.hh:83
#define LIGHT_RED
Definition: G4Scheduler.cc:84
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stop()

void G4Scheduler::Stop ( )
inline

Definition at line 413 of file G4Scheduler.hh.

414 {
415  fContinue = false;
416 }
G4bool fContinue
Definition: G4Scheduler.hh:224

◆ SynchronizeTracks()

void G4Scheduler::SynchronizeTracks ( )
protected

Definition at line 496 of file G4Scheduler.cc.

497 {
498 // if(fTrackContainer.WaitingListsNOTEmpty())
499 // {
500 // G4ExceptionDescription exceptionDescription;
501 // exceptionDescription
502 // << "There is a waiting track list (fpWaitingList != 0).";
503 // exceptionDescription
504 // << " When G4Scheduler::SynchronizeTracks() is called, ";
505 // exceptionDescription
506 // << "no more tracks should remain in the fpWaitingList.";
507 // G4Exception("G4Scheduler::SynchronizeTracks", "ITScheduler002",
508 // FatalErrorInArgument, exceptionDescription);
509 // }
510 
511  // Backup main list and time feature
512  // Reminder : the main list here, should
513  // have the biggest global time
514  // fTrackContainer.MoveMainToWaitingList();
515  // TODO: not yet supported
516 
518  //fTmpEndTime = fEndTime;
519 
521  G4double tmpGlobalTime = fGlobalTime;
522 
523  double nextWatchedTime = -1;
524  bool carryOn = true;
525 
526  while(fTrackContainer.MergeNextTimeToMainList(tmpGlobalTime) && carryOn)
527  {
528 // assert(tmpGlobalTime == fGlobalTime);
530  while((nextWatchedTime = GetNextWatchedTime()) < fTrackContainer.GetNextTime()
531  && (carryOn = CanICarryOn()))
532  {
533  fStopTime = min(nextWatchedTime, fEndTime);
534  DoProcess();
535  }
536 
537  carryOn = CanICarryOn();
538 
539  if(nextWatchedTime > fEndTime && carryOn)
540  {
542  DoProcess();
543  }
544  }
545 }
double fStopTime
Definition: G4Scheduler.hh:237
double GetNextWatchedTime() const
Definition: G4Scheduler.cc:487
double fEndTime
Definition: G4Scheduler.hh:238
bool MergeNextTimeToMainList(double &time)
bool CanICarryOn()
Definition: G4Scheduler.cc:549
double fGlobalTime
Definition: G4Scheduler.hh:234
double G4double
Definition: G4Types.hh:76
void DoProcess()
Definition: G4Scheduler.cc:601
G4ITTrackHolder & fTrackContainer
Definition: G4Scheduler.hh:267
double fTmpGlobalTime
Definition: G4Scheduler.hh:235
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UseDefaultTimeSteps()

void G4Scheduler::UseDefaultTimeSteps ( G4bool  flag)
inline

Definition at line 438 of file G4Scheduler.hh.

439 {
440  fUseDefaultTimeSteps = flag;
441 }
G4bool fUseDefaultTimeSteps
Definition: G4Scheduler.hh:232
Here is the caller graph for this function:

◆ WhyDoYouStop()

void G4Scheduler::WhyDoYouStop ( )
inline

Definition at line 433 of file G4Scheduler.hh.

434 {
435  fWhyDoYouStop = true;
436 }
bool fWhyDoYouStop
Definition: G4Scheduler.hh:221
Here is the caller graph for this function:

Member Data Documentation

◆ fContinue

G4bool G4Scheduler::fContinue
private

Definition at line 224 of file G4Scheduler.hh.

◆ fDefaultMinTimeStep

double G4Scheduler::fDefaultMinTimeStep
private

Definition at line 248 of file G4Scheduler.hh.

◆ fDefinedMinTimeStep

double G4Scheduler::fDefinedMinTimeStep
private

Definition at line 252 of file G4Scheduler.hh.

◆ fEndTime

double G4Scheduler::fEndTime
private

Definition at line 238 of file G4Scheduler.hh.

◆ fGlobalTime

double G4Scheduler::fGlobalTime
private

Definition at line 234 of file G4Scheduler.hh.

◆ fgScheduler

G4ThreadLocal G4Scheduler * G4Scheduler::fgScheduler
staticprivate

Definition at line 219 of file G4Scheduler.hh.

◆ fILTimeStep

double G4Scheduler::fILTimeStep
private

Definition at line 273 of file G4Scheduler.hh.

◆ fInitialized

bool G4Scheduler::fInitialized
private

Definition at line 222 of file G4Scheduler.hh.

◆ fInteractionStep

bool G4Scheduler::fInteractionStep
private

Definition at line 277 of file G4Scheduler.hh.

◆ fITStepStatus

G4ITStepStatus G4Scheduler::fITStepStatus
private

Definition at line 229 of file G4Scheduler.hh.

◆ fMaxNZeroTimeStepsAllowed

int G4Scheduler::fMaxNZeroTimeStepsAllowed
private

Definition at line 241 of file G4Scheduler.hh.

◆ fMaxSteps

int G4Scheduler::fMaxSteps
private

Definition at line 227 of file G4Scheduler.hh.

◆ fMaxTimeStep

double G4Scheduler::fMaxTimeStep
private

Definition at line 244 of file G4Scheduler.hh.

◆ fNbSteps

int G4Scheduler::fNbSteps
private

Definition at line 226 of file G4Scheduler.hh.

◆ fpGun

G4ITGun* G4Scheduler::fpGun
private

Definition at line 281 of file G4Scheduler.hh.

◆ fpMessenger

G4SchedulerMessenger* G4Scheduler::fpMessenger
private

Definition at line 217 of file G4Scheduler.hh.

◆ fpModelHandler

G4ITModelHandler* G4Scheduler::fpModelHandler
private

Definition at line 268 of file G4Scheduler.hh.

◆ fpModelProcessor

G4ITModelProcessor* G4Scheduler::fpModelProcessor
private

Definition at line 263 of file G4Scheduler.hh.

◆ fPreviousTimeStep

double G4Scheduler::fPreviousTimeStep
private

Definition at line 239 of file G4Scheduler.hh.

◆ fpStepProcessor

G4ITStepProcessor* G4Scheduler::fpStepProcessor
private

Definition at line 262 of file G4Scheduler.hh.

◆ fpTrackingInteractivity

G4ITTrackingInteractivity* G4Scheduler::fpTrackingInteractivity
private

Definition at line 265 of file G4Scheduler.hh.

◆ fpTrackingManager

G4ITTrackingManager* G4Scheduler::fpTrackingManager
private

Definition at line 264 of file G4Scheduler.hh.

◆ fpUserTimeStepAction

G4UserTimeStepAction* G4Scheduler::fpUserTimeStepAction
private

Definition at line 258 of file G4Scheduler.hh.

◆ fpUserTimeSteps

std::map<double, double>* G4Scheduler::fpUserTimeSteps
private

Definition at line 249 of file G4Scheduler.hh.

◆ fReachedUserTimeLimit

bool G4Scheduler::fReachedUserTimeLimit
private

Definition at line 254 of file G4Scheduler.hh.

◆ fReactionSet

G4ITReactionSet* G4Scheduler::fReactionSet
private

Definition at line 266 of file G4Scheduler.hh.

◆ fRunning

bool G4Scheduler::fRunning
private

Definition at line 223 of file G4Scheduler.hh.

◆ fStartTime

double G4Scheduler::fStartTime
private

Definition at line 236 of file G4Scheduler.hh.

◆ fStopTime

double G4Scheduler::fStopTime
private

Definition at line 237 of file G4Scheduler.hh.

◆ fTimeStep

double G4Scheduler::fTimeStep
private

Definition at line 243 of file G4Scheduler.hh.

◆ fTimeTolerance

double G4Scheduler::fTimeTolerance
private

Definition at line 233 of file G4Scheduler.hh.

◆ fTmpGlobalTime

double G4Scheduler::fTmpGlobalTime
private

Definition at line 235 of file G4Scheduler.hh.

◆ fTrackContainer

G4ITTrackHolder& G4Scheduler::fTrackContainer
private

Definition at line 267 of file G4Scheduler.hh.

◆ fTSTimeStep

double G4Scheduler::fTSTimeStep
private

Definition at line 271 of file G4Scheduler.hh.

◆ fUseDefaultTimeSteps

G4bool G4Scheduler::fUseDefaultTimeSteps
private

Definition at line 232 of file G4Scheduler.hh.

◆ fUsePreDefinedTimeSteps

bool G4Scheduler::fUsePreDefinedTimeSteps
private

Definition at line 247 of file G4Scheduler.hh.

◆ fUserUpperTimeLimit

double G4Scheduler::fUserUpperTimeLimit
mutableprivate

Definition at line 251 of file G4Scheduler.hh.

◆ fVerbose

int G4Scheduler::fVerbose
private

Definition at line 220 of file G4Scheduler.hh.

◆ fWatchedTimes

std::set<double> G4Scheduler::fWatchedTimes
private

Definition at line 256 of file G4Scheduler.hh.

◆ fWhyDoYouStop

bool G4Scheduler::fWhyDoYouStop
private

Definition at line 221 of file G4Scheduler.hh.

◆ fZeroTimeCount

int G4Scheduler::fZeroTimeCount
private

Definition at line 240 of file G4Scheduler.hh.


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