MCPcopy Create free account
hub / github.com/Geant4/geant4 / SetupShadowProcess

Method SetupShadowProcess

source/run/src/G4WorkerTaskRunManagerKernel.cc:55–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53//============================================================================//
54
55void G4WorkerTaskRunManagerKernel::SetupShadowProcess() const
56{
57 // Master thread has created processes and setup a pointer
58 // to the master process, get it and copy it in this instance
59 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
60 G4ParticleTable::G4PTblDicIterator* theParticleIterator = theParticleTable->GetIterator();
61 theParticleIterator->reset();
62 // loop on particles and get process manager from there list of processes
63 while ((*theParticleIterator)()) {
64 G4ParticleDefinition* pd = theParticleIterator->value();
65 G4ProcessManager* pm = pd->GetProcessManager();
66 G4ProcessManager* pmM = pd->GetMasterProcessManager();
67 if ((pm == nullptr) || (pmM == nullptr)) {
68 G4ExceptionDescription msg;
69 msg << "Process manager or process manager shadow to master are not set.\n";
70 msg << "Particle : " << pd->GetParticleName() << " (" << pd << "), proc-manager: " << pm;
71 msg << " proc-manager-shadow: " << pmM;
72 G4Exception("G4WorkerTaskRunManagerKernel::SetupShadowProcess()", "Run0116", FatalException,
73 msg);
74 return;
75 }
76 G4ProcessVector& procs = *(pm->GetProcessList());
77 G4ProcessVector& procsM = *(pmM->GetProcessList());
78 if (procs.size() != procsM.size()) {
79 G4cout << "G4WorkerTaskRunManagerKernel::SetupShadowProcess() for particle <"
80 << pd->GetParticleName() << ">" << G4endl;
81 G4cout << " ProcessManager : " << pm << " ProcessManagerShadow : " << pmM << G4endl;
82
83 for (G4int iv1 = 0; iv1 < (G4int)procs.size(); ++iv1)
84 G4cout << " " << iv1 << " - " << procs[iv1]->GetProcessName() << G4endl;
85
86 G4cout << "--------------------------------------------------------------" << G4endl;
87
88 for (G4int iv2 = 0; iv2 < (G4int)procsM.size(); ++iv2)
89 G4cout << " " << iv2 << " - " << procsM[iv2]->GetProcessName() << G4endl;
90
91 G4cout << "--------------------------------------------------------------" << G4endl;
92
93 G4ExceptionDescription msg;
94 msg << " Size of G4ProcessVector is inconsistent between master and worker "
95 "threads ";
96 msg << " for the particle <" << pd->GetParticleName() << ">. \n";
97 msg << " size of G4ProcessVector for worker thread is " << procs.size();
98 msg << " while master thread is " << procsM.size() << ".";
99 G4Exception("G4WorkerTaskRunManagerKernel::SetupShadowProcess()", "Run0117", FatalException,
100 msg);
101 }
102 // To each process add the reference to the same
103 // process from master. Note that we rely on
104 // processes being in the correct order!
105 // We could use some checking using process name or type
106 for (G4int idx = 0; idx < (G4int)procs.size(); ++idx) {
107 procs[idx]->SetMasterProcess(procsM[idx]);
108 }
109 }
110}

Callers

nothing calls this directly

Calls 8

G4ExceptionFunction · 0.85
GetIteratorMethod · 0.80
resetMethod · 0.45
valueMethod · 0.45
GetProcessManagerMethod · 0.45
GetParticleNameMethod · 0.45
sizeMethod · 0.45
SetMasterProcessMethod · 0.45

Tested by

no test coverage detected