81 G4cout <<
"WARNING - Attempt to delete the logical volume store"
82 <<
" while geometry closed !" <<
G4endl;
93 for(
auto pos=store->cbegin(); pos!=store->cend(); ++pos)
96 if (*pos !=
nullptr) { (*pos)->Lock();
delete *pos; }
99 store->bmap.clear(); store->mvalid =
false;
111 fgNotifier = pNotifier;
125 const G4String& vol_name = (*pos)->GetName();
126 auto it = bmap.find(vol_name);
127 if (it != bmap.cend())
129 it->second.push_back(*pos);
133 std::vector<G4LogicalVolume*> vol_vec { *pos };
134 bmap.insert(std::make_pair(vol_name, vol_vec));
148 store->push_back(pVolume);
150 auto it = store->bmap.find(vol_name);
151 if (it != store->bmap.cend())
153 it->second.push_back(pVolume);
157 std::vector<G4LogicalVolume*> vol_vec { pVolume };
158 store->bmap.insert(std::make_pair(vol_name, vol_vec));
161 store->mvalid =
true;
174 for (
auto i=store->cbegin(); i!=store->cend(); ++i)
183 auto it = store->bmap.find(vol_name);
184 if (it != store->bmap.cend())
186 if (it->second.size() > 1)
188 for (
auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
199 store->bmap.erase(it);
211 G4bool reverseSearch)
const
214 if (!store->mvalid) { store->
UpdateMap(); }
215 auto pos = store->bmap.find(name);
216 if(pos != store->bmap.cend())
218 if ((verbose) && (pos->second.size()>1))
220 std::ostringstream message;
221 message <<
"There exists more than ONE logical volume in store named: "
223 <<
"Returning the first found.";
229 return pos->second[pos->second.size()-1];
233 return pos->second[0];
238 std::ostringstream message;
239 message <<
"Volume NOT found in store !" <<
G4endl
240 <<
" Volume " << name <<
" NOT found in store !" <<
G4endl
241 <<
" Returning NULL pointer.";
255 if (fgInstance ==
nullptr)
257 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()
virtual ~G4LogicalVolumeStore()
static void DeRegister(G4LogicalVolume *pVolume)
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true, G4bool reverseSearch=false) const
static void Register(G4LogicalVolume *pVolume)
static G4LogicalVolumeStore * GetInstance()
static void SetNotifier(G4VStoreNotifier *pNotifier)
const G4String & GetName() const
virtual void NotifyRegistration()=0
virtual void NotifyDeRegistration()=0