Import Geant4 10.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2016-06-30 14:12:05 +02:00
parent a654a7ab1f
commit 4ec577e5c4
2021 changed files with 100995 additions and 78277 deletions
@@ -29,7 +29,7 @@
// This class implements the worker model run manager for TBB based
// application.
// It is instantiated by tbbUserWorkerInitialization and used by
// tbbMasterRunManager.
// SimpleTbbMasterRunManager.
// See G4WorkerRunManager for documentation of methods relative to
// base class. Only class specific methods are documented here.
//
@@ -39,26 +39,26 @@
// History:
// Oct 31st, 2013 A. Dotti - First Implementation
#include "tbbMasterRunManager.hh"
#include "SimpleTbbMasterRunManager.hh"
#include "tbbTask.hh"
tbbMasterRunManager::tbbMasterRunManager() :
SimpleTbbMasterRunManager::SimpleTbbMasterRunManager() :
G4MTRunManager(),
theTasks(static_cast<tbb::task_list*>(0)),
nEvtsPerTask(1)
{
}
tbbMasterRunManager::~tbbMasterRunManager()
SimpleTbbMasterRunManager::~SimpleTbbMasterRunManager()
{
}
void tbbMasterRunManager::TerminateWorkers()
void SimpleTbbMasterRunManager::TerminateWorkers()
{
//For TBB based example this should be empty
}
void tbbMasterRunManager::CreateAndStartWorkers()
void SimpleTbbMasterRunManager::CreateAndStartWorkers()
{
//Instead of pthread based workers, create tbbTask
G4int ntasks = numberOfEventToBeProcessed/nEvtsPerTask;
@@ -71,14 +71,14 @@ void tbbMasterRunManager::CreateAndStartWorkers()
}
}
void tbbMasterRunManager::CreateTask(G4int id,G4int evts)
void SimpleTbbMasterRunManager::CreateTask(G4int id,G4int evts)
{
tbbTask& task = * new(tbb::task::allocate_root())
tbbTask( id , NULL , evts ); //Add output for merging
theTasks->push_back( task );
}
void tbbMasterRunManager::RunTermination()
void SimpleTbbMasterRunManager::RunTermination()
{
// Reduce results ....
G4MTRunManager::RunTermination();
@@ -42,10 +42,10 @@
tbbTask::tbbTask(G4int anId,
tbb::concurrent_queue<const G4Run*>* out,
G4int nevts)
: nEvents(nevts),
thisID(anId),
output(out),
beamOnCondition(false)
: m_nEvents(nevts),
m_taskID(anId),
m_output(out),
m_beamOnCondition(false)
{
}
@@ -177,20 +177,20 @@ tbb::task* tbbTask::execute()
G4int numSelect = masterRM->GetNumberOfSelectEvents();
if ( macroFile == "" || macroFile == " " )
{
localRM->BeamOn(nEvents,0,numSelect);
localRM->BeamOn(m_nEvents,0,numSelect);
}
else
{
localRM->BeamOn(nEvents,macroFile,numSelect);
localRM->BeamOn(m_nEvents,macroFile,numSelect);
}
//======= NEW TBB SPECIFIC ===========
//Step-5: Initialize and start run
//====================================
// bla-bla-bla-bla
// This is basically BeamOn
beamOnCondition = localRM->ConfirmBeamOnCondition();
if (beamOnCondition) {
localRM->SetNumberOfEventsToBeProcessed( nEvents );
m_beamOnCondition = localRM->ConfirmBeamOnCondition();
if (m_beamOnCondition) {
localRM->SetNumberOfEventsToBeProcessed( m_nEvents );
localRM->ConstructScoringWorlds();
localRM->RunInitialization();
//Register this G4Run in output
@@ -198,12 +198,12 @@ tbb::task* tbbTask::execute()
//G4Run or derived class. We let the kernel know this is the object
//where the output is accumulated for the tbb::tasks that run on
//this thread.
if ( output ) {}
if ( m_output ) {}
}
}
assert(localRM!=0);
if ( beamOnCondition ) {
localRM->DoEventLoop( nEvents );
if ( m_beamOnCondition ) {
localRM->DoEventLoop( m_nEvents );
//localRM->RunTermination(); //<<<< How to call this??? ANDREA TBB
}