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

Method InitializeGeometry

source/run/src/G4WorkerRunManager.cc:146–179  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

144
145// --------------------------------------------------------------------
146void G4WorkerRunManager::InitializeGeometry()
147{
148 if (userDetector == nullptr) {
149 G4Exception("G4RunManager::InitializeGeometry", "Run0033", FatalException,
150 "G4VUserDetectorConstruction is not defined!");
151 return;
152 }
153
154 if (fGeometryHasBeenDestroyed) {
155 G4TransportationManager::GetTransportationManager()->ClearParallelWorlds();
156 }
157
158 // Step 0: Contribute to the voxelisation of the geometry
159 G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
160 if( geomManager->IsParallelOptimisationConfigured() && ! geomManager->IsParallelOptimisationFinished() ) {
161 G4cout << "G4RunManager::InitializeGeometry calling GeometryManager's UndertakeOptimisation"
162 << G4endl; // TODO - suppress / delete this in final version
163 geomManager->UndertakeOptimisation();
164 }
165 // A barrier must ensure that all that all threads have finished this work.
166 // Currently we rely on the (later) barrier at the end of initialisation.
167
168 // Step1: Get pointer to the physiWorld (note: needs to get the "super
169 // pointer, i.e. the one shared by all threads"
170 G4RunManagerKernel* masterKernel = G4MTRunManager::GetMasterRunManagerKernel();
171 G4VPhysicalVolume* worldVol = masterKernel->GetCurrentWorld();
172 // Step2:, Call a new "WorkerDefineWorldVolume( pointer from 2-, false);
173 kernel->WorkerDefineWorldVolume(worldVol, false);
174 kernel->SetNumberOfParallelWorld(masterKernel->GetNumberOfParallelWorld());
175 // Step3: Call user's ConstructSDandField()
176 userDetector->ConstructSDandField();
177 userDetector->ConstructParallelSD();
178 geometryInitialized = true;
179}
180
181// --------------------------------------------------------------------
182void G4WorkerRunManager::RunInitialization()

Callers

nothing calls this directly

Calls 12

G4ExceptionFunction · 0.85
GetInstanceFunction · 0.85
ClearParallelWorldsMethod · 0.80
GetCurrentWorldMethod · 0.80
ConstructParallelSDMethod · 0.80
UndertakeOptimisationMethod · 0.45
ConstructSDandFieldMethod · 0.45

Tested by

no test coverage detected