84 G4cout <<
"WARNING - Attempt to delete the region store"
85 <<
" while geometry closed !" <<
G4endl;
96 for(
auto pos=store->cbegin(); pos!=store->cend(); ++pos)
102 store->bmap.clear(); store->mvalid =
false;
114 fgNotifier = pNotifier;
128 const G4String& reg_name = (*pos)->GetName();
129 auto it = bmap.find(reg_name);
130 if (it != bmap.cend())
132 it->second.push_back(*pos);
136 std::vector<G4Region*> reg_vec { *pos };
137 bmap.insert(std::make_pair(reg_name, reg_vec));
151 store->push_back(pRegion);
153 auto it = store->bmap.find(reg_name);
154 if (it != store->bmap.cend())
156 it->second.push_back(pRegion);
160 std::vector<G4Region*> reg_vec { pRegion };
161 store->bmap.insert(std::make_pair(reg_name, reg_vec));
164 store->mvalid =
true;
177 for (
auto i=store->cbegin(); i!=store->cend(); ++i)
186 auto it = store->bmap.find(reg_name);
187 if (it != store->bmap.cend())
189 if (it->second.size() > 1)
191 for (
auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
202 store->bmap.erase(it);
215 if (fgInstance ==
nullptr)
217 fgInstance = &worldStore;
231 if ((*i)->IsModified()) {
return true; }
245 (*i)->RegionModified(
false);
257 if((*i)->IsInMassGeometry() || (*i)->IsInParallelGeometry()
258 || (currentWorld !=
nullptr))
259 { (*i)->UpdateMaterialList(); }
270 if (!store->mvalid) { store->
UpdateMap(); }
271 auto pos = store->bmap.find(name);
272 if(pos != store->bmap.cend())
274 if ((verbose) && (pos->second.size()>1))
276 std::ostringstream message;
277 message <<
"There exists more than ONE region in store named: "
279 <<
"Returning the first found.";
283 return pos->second[0];
287 std::ostringstream message;
288 message <<
"Region NOT found in store !" <<
G4endl
289 <<
" Region " << name <<
" NOT found in store !" <<
G4endl
290 <<
" Returning NULL pointer.";
306 if (target ==
nullptr)
323 { (*i)->SetWorld(
nullptr); }
329 std::size_t nPhys = fPhysicalVolumeStore->size();
330 for(std::size_t iPhys=0; iPhys<nPhys; ++iPhys)
338 { (*i)->SetWorld(fPhys); }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
static G4bool IsGeometryClosed()
static G4PhysicalVolumeStore * GetInstance()
static void DeRegister(G4Region *pRegion)
static void Register(G4Region *pRegion)
static G4RegionStore * GetInstance()
static void SetNotifier(G4VStoreNotifier *pNotifier)
void UpdateMaterialList(G4VPhysicalVolume *currentWorld=nullptr)
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
G4Region * FindOrCreateRegion(const G4String &name)
void ResetRegionModified()
G4bool IsModified() const
const G4String & GetName() const
virtual void NotifyRegistration()=0
virtual void NotifyDeRegistration()=0
G4LogicalVolume * GetMotherLogical() const