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

Method SetupShadowProcess

source/run/src/G4WorkerRunManagerKernel.cc:57–108  ·  view source on GitHub ↗

--------------------------------------------------------------------

Source from the content-addressed store, hash-verified

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

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