--------------------------------------------------------------------
| 386 | |
| 387 | // -------------------------------------------------------------------- |
| 388 | void G4RunManagerKernel::WorkerDefineWorldVolume(G4VPhysicalVolume* worldVol, |
| 389 | G4bool topologyIsChanged) |
| 390 | { |
| 391 | G4StateManager* stateManager = G4StateManager::GetStateManager(); |
| 392 | G4ApplicationState currentState = stateManager->GetCurrentState(); |
| 393 | if (currentState != G4State_Init) { |
| 394 | if (currentState != G4State_Idle && currentState != G4State_PreInit) { |
| 395 | G4cout << "Current application state is " << stateManager->GetStateString(currentState) |
| 396 | << G4endl; |
| 397 | G4Exception("G4RunManagerKernel::DefineWorldVolume", "DefineWorldVolumeAtIncorrectState", |
| 398 | FatalException, "Geant4 kernel is not Init state : Method ignored."); |
| 399 | return; |
| 400 | } |
| 401 | |
| 402 | stateManager->SetNewState(G4State_Init); |
| 403 | } |
| 404 | |
| 405 | currentWorld = worldVol; |
| 406 | G4MTRunManager* masterRM = G4MTRunManager::GetMasterRunManager(); |
| 407 | G4TransportationManager* transM = G4TransportationManager::GetTransportationManager(); |
| 408 | G4MTRunManager::masterWorlds_t masterWorlds = masterRM->GetMasterWorlds(); |
| 409 | for (const auto& masterWorld : masterWorlds) { |
| 410 | if (masterWorld.first == 0) { |
| 411 | if (masterWorld.second != currentWorld) { |
| 412 | G4Exception("G4RunManagerKernel::WorkerDefineWorldVolume", "RUN3091", FatalException, |
| 413 | "Mass world is inconsistent"); |
| 414 | } |
| 415 | transM->SetWorldForTracking(masterWorld.second); |
| 416 | } |
| 417 | else { |
| 418 | transM->RegisterWorld(masterWorld.second); |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | if (topologyIsChanged) geometryNeedsToBeClosed = true; |
| 423 | |
| 424 | // Notify the VisManager as well |
| 425 | if (G4Threading::IsMasterThread()) { |
| 426 | G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); |
| 427 | if (pVVisManager != nullptr) pVVisManager->GeometryHasChanged(); |
| 428 | } |
| 429 | |
| 430 | geometryInitialized = true; |
| 431 | stateManager->SetNewState(currentState); |
| 432 | if (physicsInitialized && currentState != G4State_Idle) { |
| 433 | stateManager->SetNewState(G4State_Idle); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | // -------------------------------------------------------------------- |
| 438 | void G4RunManagerKernel::DefineWorldVolume(G4VPhysicalVolume* worldVol, G4bool topologyIsChanged) |
no test coverage detected