33 #include "G4GeometryManager.hh"
35 #include "G4AutoLock.hh"
39 G4Mutex mapMutex = G4MUTEX_INITIALIZER;
78 if (G4GeometryManager::IsGeometryClosed())
80 G4cout <<
"WARNING - Attempt to delete the solid store"
81 <<
" while geometry closed !" << G4endl;
93 #ifdef G4GEOMETRY_VOXELDEBUG
94 G4cout <<
"Deleting Solids ... ";
97 for(
auto pos=store->cbegin();
pos!=store->cend(); ++
pos)
103 #ifdef G4GEOMETRY_VOXELDEBUG
104 if (store->size() < i-1)
105 { G4cout <<
"No solids deleted. Already deleted by user ?" << G4endl; }
107 { G4cout << i-1 <<
" solids deleted !" << G4endl; }
131 G4AutoLock l(&mapMutex);
136 const G4String& sol_name = (*pos)->GetName();
137 auto it =
bmap.find(sol_name);
140 it->second.push_back(*
pos);
144 std::vector<G4VSolid*> sol_vec { *
pos };
145 bmap.insert(std::make_pair(sol_name, sol_vec));
159 store->push_back(pSolid);
160 const G4String& sol_name = pSolid->GetName();
161 auto it = store->
bmap.find(sol_name);
162 if (
it != store->
bmap.cend())
164 it->second.push_back(pSolid);
168 std::vector<G4VSolid*> sol_vec { pSolid };
169 store->
bmap.insert(std::make_pair(sol_name, sol_vec));
185 for (
auto i=store->crbegin(); i!=store->crend(); ++i)
189 store->erase(std::next(i).base());
194 const G4String& sol_name = pSolid->GetName();
195 auto it = store->
bmap.find(sol_name);
196 if (
it != store->
bmap.cend())
198 if (
it->second.size() > 1)
200 for (
auto i=
it->second.cbegin(); i!=
it->second.cend(); ++i)
222 G4bool reverseSearch)
const
226 auto pos = store->
bmap.find(name);
229 if ((verbose) && (
pos->second.size()>1))
231 std::ostringstream message;
232 message <<
"There exists more than ONE solid in store named: "
233 << name <<
"!" << G4endl
234 <<
"Returning the first found.";
235 G4Exception(
"G4SolidStore::GetSolid()",
236 "GeomMgt1001", JustWarning, message);
240 return pos->second[
pos->second.size()-1];
244 return pos->second[0];
249 std::ostringstream message;
250 message <<
"Solid " << name <<
" not found in store !" << G4endl
251 <<
"Returning NULL pointer.";
252 G4Exception(
"G4SolidStore::GetSolid()",
253 "GeomMgt1001", JustWarning, message);