84 G4cout <<
"WARNING - Attempt to delete the region store"
85 <<
" while geometry closed !" <<
G4endl;
97#ifdef G4GEOMETRY_VOXELDEBUG
98 G4cout <<
"Deleting Regions ... ";
101 for(
auto pos=store->cbegin();
pos!=store->cend(); ++
pos)
107#ifdef G4GEOMETRY_VOXELDEBUG
108 if (store->size() < i-1)
109 {
G4cout <<
"No regions deleted. Already deleted by user ?" <<
G4endl; }
140 const G4String& reg_name = (*pos)->GetName();
141 auto it =
bmap.find(reg_name);
142 if (it !=
bmap.cend())
144 it->second.push_back(*
pos);
148 std::vector<G4Region*> reg_vec { *
pos };
149 bmap.insert(std::make_pair(reg_name, reg_vec));
163 store->push_back(pRegion);
165 auto it = store->
bmap.find(reg_name);
166 if (it != store->
bmap.cend())
168 it->second.push_back(pRegion);
172 std::vector<G4Region*> reg_vec { pRegion };
173 store->
bmap.insert(std::make_pair(reg_name, reg_vec));
189 for (
auto i=store->cbegin(); i!=store->cend(); ++i)
198 auto it = store->
bmap.find(reg_name);
199 if (it != store->
bmap.cend())
201 if (it->second.size() > 1)
203 for (
auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
214 store->
bmap.erase(it);
243 if ((*i)->IsModified()) {
return true; }
257 (*i)->RegionModified(
false);
269 if((*i)->IsInMassGeometry() || (*i)->IsInParallelGeometry()
270 || (currentWorld !=
nullptr))
271 { (*i)->UpdateMaterialList(); }
286 if ((verbose) && (
pos->second.size()>1))
288 std::ostringstream message;
289 message <<
"There exists more than ONE region in store named: "
291 <<
"Returning the first found.";
295 return pos->second[0];
299 std::ostringstream message;
300 message <<
"Region NOT found in store !" <<
G4endl
301 <<
" Region " <<
name <<
" NOT found in store !" <<
G4endl
302 <<
" Returning NULL pointer.";
318 if (target ==
nullptr)
335 { (*i)->SetWorld(
nullptr); }
341 size_t nPhys = fPhysicalVolumeStore->size();
342 for(
size_t iPhys=0; iPhys<nPhys; ++iPhys)
350 { (*i)->SetWorld(fPhys); }
static const G4double pos
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 G4ThreadLocal G4bool locked
static void SetNotifier(G4VStoreNotifier *pNotifier)
void UpdateMaterialList(G4VPhysicalVolume *currentWorld=nullptr)
static G4RegionStore * fgInstance
static G4ThreadLocal G4VStoreNotifier * fgNotifier
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
std::map< G4String, std::vector< G4Region * > > bmap
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
const char * name(G4int ptype)