#include <G4SolidStore.hh>
Definition at line 54 of file G4SolidStore.hh.
◆ ~G4SolidStore()
G4SolidStore::~G4SolidStore |
( |
| ) |
|
|
virtual |
◆ G4SolidStore() [1/2]
◆ G4SolidStore() [2/2]
G4SolidStore::G4SolidStore |
( |
| ) |
|
|
protected |
◆ Clean()
void G4SolidStore::Clean |
( |
| ) |
|
|
static |
Definition at line 74 of file G4SolidStore.cc.
75{
76
77
79 {
80 G4cout <<
"WARNING - Attempt to delete the solid store"
81 <<
" while geometry closed !" <<
G4endl;
82 return;
83 }
84
85
86
87
88 locked = true;
89
91
92 for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
93 {
96 }
97
98 store->bmap.clear(); store->mvalid = false;
99 locked = false;
100 store->clear();
101}
G4GLOB_DLL std::ostream G4cout
static G4bool IsGeometryClosed()
static G4SolidStore * GetInstance()
virtual void NotifyDeRegistration()=0
Referenced by G4RunManager::ReinitializeGeometry(), and ~G4SolidStore().
◆ DeRegister()
void G4SolidStore::DeRegister |
( |
G4VSolid * | pSolid | ) |
|
|
static |
Definition at line 167 of file G4SolidStore.cc.
168{
170 if (!locked)
171 {
173 for (auto i=store->crbegin(); i!=store->crend(); ++i)
174 {
175 if (**i==*pSolid)
176 {
177 store->erase(std::next(i).base());
178 store->mvalid = false;
179 break;
180 }
181 }
183 auto it = store->bmap.find(sol_name);
184 if (it != store->bmap.cend())
185 {
186 if (it->second.size() > 1)
187 {
188 for (auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
189 {
190 if (**i==*pSolid)
191 {
192 it->second.erase(i);
193 break;
194 }
195 }
196 }
197 else
198 {
199 store->bmap.erase(it);
200 }
201 }
202 }
203}
Referenced by G4Voxelizer::G4Voxelizer(), and G4VSolid::~G4VSolid().
◆ GetInstance()
Definition at line 250 of file G4SolidStore.cc.
251{
253 if (fgInstance == nullptr)
254 {
255 fgInstance = &worldStore;
256 }
257 return fgInstance;
258}
Referenced by Clean(), DeRegister(), G4Voxelizer::G4Voxelizer(), G4VSolid::G4VSolid(), G4VSolid::G4VSolid(), G4VSolid::G4VSolid(), G4GDMLReadSolids::GetSolid(), GetSolid(), Register(), G4RunManager::ReinitializeGeometry(), G4VSolid::SetName(), SetNotifier(), G4GeometryManager::SetWorldMaximumExtent(), G4GDMLRead::StripNames(), UpdateMap(), and G4VSolid::~G4VSolid().
◆ GetMap()
const std::map< G4String, std::vector< G4VSolid * > > & G4SolidStore::GetMap |
( |
| ) |
const |
|
inline |
◆ GetSolid()
Definition at line 209 of file G4SolidStore.cc.
211{
213 if (!store->mvalid) { store->
UpdateMap(); }
214 auto pos = store->bmap.find(name);
215 if(pos != store->bmap.cend())
216 {
217 if ((verbose) && (
pos->second.size()>1))
218 {
219 std::ostringstream message;
220 message << "There exists more than ONE solid in store named: "
222 << "Returning the first found.";
225 }
226 if(reverseSearch)
227 {
228 return pos->second[
pos->second.size()-1];
229 }
230 else
231 {
232 return pos->second[0];
233 }
234 }
235 if (verbose)
236 {
237 std::ostringstream message;
238 message <<
"Solid " <<
name <<
" not found in store !" <<
G4endl
239 << "Returning NULL pointer.";
242 }
243 return nullptr;
244}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
const char * name(G4int ptype)
Referenced by G4GDMLReadSolids::GetSolid().
◆ IsMapValid()
G4bool G4SolidStore::IsMapValid |
( |
| ) |
const |
|
inline |
◆ operator=()
◆ Register()
void G4SolidStore::Register |
( |
G4VSolid * | pSolid | ) |
|
|
static |
Definition at line 144 of file G4SolidStore.cc.
145{
147 store->push_back(pSolid);
149 auto it = store->bmap.find(sol_name);
150 if (it != store->bmap.cend())
151 {
152 it->second.push_back(pSolid);
153 }
154 else
155 {
156 std::vector<G4VSolid*> sol_vec { pSolid };
157 store->bmap.insert(std::make_pair(sol_name, sol_vec));
158 }
160 store->mvalid = true;
161}
virtual void NotifyRegistration()=0
Referenced by G4VSolid::G4VSolid(), G4VSolid::G4VSolid(), and G4VSolid::G4VSolid().
◆ SetMapValid()
void G4SolidStore::SetMapValid |
( |
G4bool | val | ) |
|
|
inline |
◆ SetNotifier()
◆ UpdateMap()
void G4SolidStore::UpdateMap |
( |
| ) |
|
Definition at line 117 of file G4SolidStore.cc.
118{
120 if (mvalid) return;
121 bmap.clear();
123 {
124 const G4String& sol_name = (*pos)->GetName();
125 auto it = bmap.find(sol_name);
126 if (it != bmap.cend())
127 {
128 it->second.push_back(*pos);
129 }
130 else
131 {
132 std::vector<G4VSolid*> sol_vec { *
pos };
133 bmap.insert(std::make_pair(sol_name, sol_vec));
134 }
135 }
136 mvalid = true;
137 l.unlock();
138}
Referenced by GetSolid(), and G4GDMLRead::StripNames().
The documentation for this class was generated from the following files: