32 std::vector<G4WorkerRunManager*>* G4MTRunManagerKernel::workerRMvector = 0;
41 #ifndef G4MULTITHREADED
43 msg<<
"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
44 msg<<
" This type of RunManager can only be used in mult-threaded applications.";
48 if(!workerRMvector) workerRMvector =
new std::vector<G4WorkerRunManager*>;
59 if(workerRMvector->size()>0)
62 msg<<
"G4MTRunManagerKernel is to be deleted while "
63 <<workerRMvector->size()<<
" G4WorkerRunManager are still alive.";
64 G4Exception(
"G4RunManagerKernel::~G4RunManagerKernel()",
67 delete workerRMvector;
103 {
return wThreadContext; }
164 workerRMvector->push_back(wrm);
172 wrm->G4RunManager::SetUserInitialization(const_cast<G4VUserDetectorConstruction*>(detector));
200 std::vector<G4WorkerRunManager*>::iterator itrWrm = workerRMvector->begin();
201 for(;itrWrm!=workerRMvector->end();itrWrm++)
205 workerRMvector->erase(itrWrm);
219 return static_cast<void*
>(0);
239 for(
G4int i=0;i<nCh;i++)
248 std::vector<G4WorkerRunManager*>::iterator itr = workerRMvector->begin();
249 for(;itr!=workerRMvector->end();itr++)
250 { (*itr)->AbortRun(softAbort); }
static void * StartThread(void *context)
virtual void SetupShadowProcess() const
void SetMultithreadedApplication(G4bool value)
void SetUpDecayChannels()
void SetUpForAThread(G4int tId)
std::ostringstream G4ExceptionDescription
virtual void SetupRNGEngine(const CLHEP::HepRandomEngine *aRNGEngine) const
virtual void WorkerInitialize() const
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
int WorkerThreadLeavesPool()
virtual void WorkerStart() const
G4ParticleDefinition * GetDaughter(G4int anIndex)
static void BuildGeometryAndPhysicsVector()
void G4SetThreadId(G4int aNewValue)
G4VDecayChannel * GetDecayChannel(G4int index) const
const G4UserWorkerInitialization * GetUserWorkerInitialization() const
virtual G4WorkerRunManager * CreateWorkerRunManager() const
virtual void SetUserInitialization(G4VUserPhysicsList *userInit)
virtual ~G4MTRunManagerKernel()
#define G4MUTEX_INITIALIZER
void SetPinAffinity(G4int aff) const
static G4UImanager * GetUIpointer()
void SetupShadowProcess() const
void reset(G4bool ifSkipIon=true)
static G4WorkerThread * GetWorkerThread()
static G4MTRunManager * GetMasterRunManager()
virtual void Build() const =0
G4int GetPinAffinity() const
G4int GetThreadId() const
int WorkerThreadJoinsPool()
const G4VUserActionInitialization * GetUserActionInitialization() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetWorkerThread(G4WorkerThread *wc)
Sets the worker context.
const G4UserWorkerThreadInitialization * GetUserWorkerThreadInitialization() const
static void SetInstance(G4VSteppingVerbose *Instance)
static G4ParticleTable * GetParticleTable()
virtual void WorkerStop() const
G4VUserActionInitialization * GetNonConstUserActionInitialization() const
const CLHEP::HepRandomEngine * getMasterRandomEngine() const
virtual G4VSteppingVerbose * InitializeSteppingVerbose() const
static void DestroyGeometryAndPhysicsVector()
virtual void Initialize()
const G4VUserPhysicsList * GetUserPhysicsList() const
void BroadcastAbortRun(G4bool softAbort)
G4PTblDicIterator * GetIterator() const