82 G4cout <<
"WARNING - Attempt to delete the physical volume store"
83 <<
" while geometry closed !" <<
G4endl;
95 for(
auto pos=store->cbegin(); pos!=store->cend(); ++pos)
101 store->bmap.clear(); store->mvalid =
false;
113 fgNotifier = pNotifier;
127 const G4String& vol_name = (*pos)->GetName();
128 auto it = bmap.find(vol_name);
129 if (it != bmap.cend())
131 it->second.push_back(*pos);
135 std::vector<G4VPhysicalVolume*> vol_vec { *pos };
136 bmap.insert(std::make_pair(vol_name, vol_vec));
150 store->push_back(pVolume);
152 auto it = store->bmap.find(vol_name);
153 if (it != store->bmap.cend())
155 it->second.push_back(pVolume);
159 std::vector<G4VPhysicalVolume*> vol_vec { pVolume };
160 store->bmap.insert(std::make_pair(vol_name, vol_vec));
163 store->mvalid =
true;
178 if (motherLogical !=
nullptr) { motherLogical->
RemoveDaughter(pVolume); }
179 for (
auto i=store->cbegin(); i!=store->cend(); ++i)
188 auto it = store->bmap.find(vol_name);
189 if (it != store->bmap.cend())
191 if (it->second.size() > 1)
193 for (
auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
204 store->bmap.erase(it);
216 G4bool reverseSearch)
const
219 if (!store->mvalid) { store->
UpdateMap(); }
220 auto pos = store->bmap.find(name);
221 if(pos != store->bmap.cend())
223 if ((verbose) && (pos->second.size()>1))
225 std::ostringstream message;
226 message <<
"There exists more than ONE physical volume in store named: "
228 <<
"Returning the first found.";
234 return pos->second[pos->second.size()-1];
238 return pos->second[0];
243 std::ostringstream message;
244 message <<
"Volume NOT found in store !" <<
G4endl
245 <<
" Volume " << name <<
" NOT found in store !" <<
G4endl
246 <<
" Returning NULL pointer.";
260 if (fgInstance ==
nullptr)
262 fgInstance = &worldStore;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
static G4bool IsGeometryClosed()
void RemoveDaughter(const G4VPhysicalVolume *p)
static G4PhysicalVolumeStore * GetInstance()
static void Register(G4VPhysicalVolume *pSolid)
static void SetNotifier(G4VStoreNotifier *pNotifier)
static void DeRegister(G4VPhysicalVolume *pSolid)
virtual ~G4PhysicalVolumeStore()
G4VPhysicalVolume * GetVolume(const G4String &name, G4bool verbose=true, G4bool reverseSearch=false) const
virtual void NotifyRegistration()=0
virtual void NotifyDeRegistration()=0
G4LogicalVolume * GetMotherLogical() const
const G4String & GetName() const