74#ifndef G4MULTITHREADED
76 msg <<
"Geant4 code is compiled without multi-threading support "
79 msg <<
" This type of RunManager can only be used in mult-threaded "
81 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0109",
105 using WorkerRunManPtr_t = std::unique_ptr<G4WorkerTaskRunManager>;
106 using WorkerThreadPtr_t = std::unique_ptr<G4WorkerThread>;
108 WorkerRunManPtr_t& workerRM()
114 WorkerThreadPtr_t& context()
126 return context().get();
133 if(context() && workerRM())
167 G4int thisID = context()->GetThreadId();
198 context()->BuildGeometryAndPhysicsVector();
201 auto& wrm = workerRM();
202 wrm->SetWorkerThread(context().get());
210 wrm->G4RunManager::SetUserInitialization(
223 workerRM()->Initialize();
249 auto& wrm = workerRM();
250 assert(wrm.get() !=
nullptr);
272 auto& wrm = workerRM();
273 assert(wrm.get() !=
nullptr);
347 for(
G4int i = 0; i < nCh; i++)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4VDecayChannel * GetDecayChannel(G4int index) const
G4int GetPinAffinity() const
const CLHEP::HepRandomEngine * getMasterRandomEngine() const
static G4ThreadId GetMasterThreadId()
void reset(G4bool ifSkipIon=true)
G4PTblDicIterator * GetIterator() const
static G4ParticleTable * GetParticleTable()
virtual void SetupShadowProcess() const
const G4UserWorkerInitialization * GetUserWorkerInitialization() const
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
const G4VUserActionInitialization * GetUserActionInitialization() const
G4VUserActionInitialization * GetNonConstUserActionInitialization() const
const G4VUserPhysicsList * GetUserPhysicsList() const
const G4UserWorkerThreadInitialization * GetUserWorkerThreadInitialization() const
virtual ~G4TaskRunManagerKernel()
void BroadcastAbortRun(G4bool softAbort)
static void ExecuteWorkerTask()
static void InitializeWorker()
void SetupShadowProcess() const
static void TerminateWorker()
static G4TASK_DLL std::vector< G4String > initCmdStack
static void TerminateWorkerRunEventLoop()
static G4WorkerThread * GetWorkerThread()
static void ExecuteWorkerInit()
void SetUpDecayChannels()
static std::vector< G4String > & InitCommandStack()
static G4TaskRunManager * GetMasterRunManager()
void SetUpForAThread(G4int tId)
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
virtual void WorkerStop() const
virtual void WorkerInitialize() const
virtual void WorkerStart() const
virtual void SetupRNGEngine(const CLHEP::HepRandomEngine *aRNGEngine) const
virtual G4WorkerRunManager * CreateWorkerRunManager() const
G4ParticleDefinition * GetDaughter(G4int anIndex)
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Build() const =0
virtual G4VSteppingVerbose * InitializeSteppingVerbose() const
virtual void RunTermination() override
virtual void TerminateEventLoop() override
G4WorkerThread * GetWorkerThread() const
static void DestroyGeometryAndPhysicsVector()
std::future< RetT > async(FuncT &&func, Args &&... args)
TaskManager * GetTaskManager() const
ThreadPool * GetThreadPool() const
static uintmax_t get_this_thread_id()
G4int WorkerThreadJoinsPool()
G4int WorkerThreadLeavesPool()
void SetMultithreadedApplication(G4bool value)
void G4SetThreadId(G4int aNewValue)
void G4ConsumeParameters(_Args &&...)
#define G4ThreadLocalStatic