82 G4cout <<
"WARNING - Attempt to delete the physical volume store"
83 <<
" while geometry closed !" <<
G4endl;
96#ifdef G4GEOMETRY_VOXELDEBUG
97 G4cout <<
"Deleting Physical Volumes ... ";
100 for(
auto pos=store->cbegin();
pos!=store->cend(); ++
pos)
106#ifdef G4GEOMETRY_VOXELDEBUG
107 if (store->size() < i-1)
108 {
G4cout <<
"No volumes deleted. Already deleted by user ?" <<
G4endl; }
139 const G4String& vol_name = (*pos)->GetName();
140 auto it =
bmap.find(vol_name);
141 if (it !=
bmap.cend())
143 it->second.push_back(*
pos);
147 std::vector<G4VPhysicalVolume*> vol_vec { *
pos };
148 bmap.insert(std::make_pair(vol_name, vol_vec));
162 store->push_back(pVolume);
164 auto it = store->
bmap.find(vol_name);
165 if (it != store->
bmap.cend())
167 it->second.push_back(pVolume);
171 std::vector<G4VPhysicalVolume*> vol_vec { pVolume };
172 store->
bmap.insert(std::make_pair(vol_name, vol_vec));
190 if (motherLogical !=
nullptr) { motherLogical->
RemoveDaughter(pVolume); }
191 for (
auto i=store->cbegin(); i!=store->cend(); ++i)
200 auto it = store->
bmap.find(vol_name);
201 if (it != store->
bmap.cend())
203 if (it->second.size() > 1)
205 for (
auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
216 store->
bmap.erase(it);
228 G4bool reverseSearch)
const
235 if ((verbose) && (
pos->second.size()>1))
237 std::ostringstream message;
238 message <<
"There exists more than ONE physical volume in store named: "
240 <<
"Returning the first found.";
246 return pos->second[
pos->second.size()-1];
250 return pos->second[0];
255 std::ostringstream message;
256 message <<
"Volume NOT found in store !" <<
G4endl
257 <<
" Volume " <<
name <<
" NOT found in store !" <<
G4endl
258 <<
" Returning NULL pointer.";
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()
void RemoveDaughter(const G4VPhysicalVolume *p)
static G4PhysicalVolumeStore * GetInstance()
static G4ThreadLocal G4VStoreNotifier * fgNotifier
static void Register(G4VPhysicalVolume *pSolid)
static void SetNotifier(G4VStoreNotifier *pNotifier)
static void DeRegister(G4VPhysicalVolume *pSolid)
static G4PhysicalVolumeStore * fgInstance
std::map< G4String, std::vector< G4VPhysicalVolume * > > bmap
virtual ~G4PhysicalVolumeStore()
static G4ThreadLocal G4bool locked
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
const char * name(G4int ptype)