81 G4cout <<
"WARNING - Attempt to delete the logical volume store"
82 <<
" while geometry closed !" <<
G4endl;
94#ifdef G4GEOMETRY_VOXELDEBUG
95 G4cout <<
"Deleting Logical Volumes ... ";
98 for(
auto pos=store->cbegin();
pos!=store->cend(); ++
pos)
101 if (*
pos !=
nullptr) { (*pos)->Lock();
delete *
pos; }
105#ifdef G4GEOMETRY_VOXELDEBUG
106 if (store->size() < i-1)
107 {
G4cout <<
"No volumes deleted. Already deleted by user ?" <<
G4endl; }
138 const G4String& vol_name = (*pos)->GetName();
139 auto it =
bmap.find(vol_name);
140 if (it !=
bmap.cend())
142 it->second.push_back(*
pos);
146 std::vector<G4LogicalVolume*> vol_vec { *
pos };
147 bmap.insert(std::make_pair(vol_name, vol_vec));
161 store->push_back(pVolume);
163 auto it = store->
bmap.find(vol_name);
164 if (it != store->
bmap.cend())
166 it->second.push_back(pVolume);
170 std::vector<G4LogicalVolume*> vol_vec { pVolume };
171 store->
bmap.insert(std::make_pair(vol_name, vol_vec));
187 for (
auto i=store->cbegin(); i!=store->cend(); ++i)
196 auto it = store->
bmap.find(vol_name);
197 if (it != store->
bmap.cend())
199 if (it->second.size() > 1)
201 for (
auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
212 store->
bmap.erase(it);
224 G4bool reverseSearch)
const
231 if ((verbose) && (
pos->second.size()>1))
233 std::ostringstream message;
234 message <<
"There exists more than ONE logical volume in store named: "
236 <<
"Returning the first found.";
242 return pos->second[
pos->second.size()-1];
246 return pos->second[0];
251 std::ostringstream message;
252 message <<
"Volume NOT found in store !" <<
G4endl
253 <<
" Volume " <<
name <<
" NOT found in store !" <<
G4endl
254 <<
" 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()
static G4ThreadLocal G4bool locked
virtual ~G4LogicalVolumeStore()
static G4ThreadLocal G4VStoreNotifier * fgNotifier
static void DeRegister(G4LogicalVolume *pVolume)
static G4LogicalVolumeStore * fgInstance
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)
std::map< G4String, std::vector< G4LogicalVolume * > > bmap
const G4String & GetName() const
virtual void NotifyRegistration()=0
virtual void NotifyDeRegistration()=0
const char * name(G4int ptype)