Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4RegionStore Class Reference

#include <G4RegionStore.hh>

+ Inheritance diagram for G4RegionStore:

Public Member Functions

G4bool IsModified () const
 
void ResetRegionModified ()
 
void UpdateMaterialList (G4VPhysicalVolume *currentWorld=0)
 
G4RegionGetRegion (const G4String &name, G4bool verbose=true) const
 
G4RegionFindOrCreateRegion (const G4String &name)
 
void SetWorldVolume ()
 

Static Public Member Functions

static void Register (G4Region *pSolid)
 
static void DeRegister (G4Region *pSolid)
 
static G4RegionStoreGetInstance ()
 
static void SetNotifier (G4VStoreNotifier *pNotifier)
 
static void Clean ()
 

Protected Member Functions

 G4RegionStore ()
 
virtual ~G4RegionStore ()
 

Detailed Description

Definition at line 63 of file G4RegionStore.hh.

Constructor & Destructor Documentation

◆ G4RegionStore()

G4RegionStore::G4RegionStore ( )
protected

Definition at line 58 of file G4RegionStore.cc.

59 : std::vector<G4Region*>()
60{
61 reserve(20);
62}

◆ ~G4RegionStore()

G4RegionStore::~G4RegionStore ( )
protectedvirtual

Definition at line 68 of file G4RegionStore.cc.

69{
70 Clean();
71}
static void Clean()

Member Function Documentation

◆ Clean()

void G4RegionStore::Clean ( )
static

Definition at line 77 of file G4RegionStore.cc.

78{
79 // Do nothing if geometry is closed
80 //
81 if (G4GeometryManager::GetInstance()->IsGeometryClosed())
82 {
83 G4cout << "WARNING - Attempt to delete the region store"
84 << " while geometry closed !" << G4endl;
85 return;
86 }
87
88 // Locks store for deletion of regions. De-registration will be
89 // performed at this stage. G4Regions will not de-register themselves.
90 //
91 locked = true;
92
93 size_t i=0;
94 G4RegionStore* store = GetInstance();
95
96#ifdef G4GEOMETRY_VOXELDEBUG
97 G4cout << "Deleting Regions ... ";
98#endif
99
100 for(iterator pos=store->begin(); pos!=store->end(); ++pos)
101 {
102 if (fgNotifier) { fgNotifier->NotifyDeRegistration(); }
103 if (*pos) { delete *pos; }
104 i++;
105 }
106
107#ifdef G4GEOMETRY_VOXELDEBUG
108 if (store->size() < i-1)
109 { G4cout << "No regions deleted. Already deleted by user ?" << G4endl; }
110 else
111 { G4cout << i-1 << " regions deleted !" << G4endl; }
112#endif
113
114 locked = false;
115 store->clear();
116}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static G4GeometryManager * GetInstance()
static G4RegionStore * GetInstance()
virtual void NotifyDeRegistration()=0

Referenced by ~G4RegionStore().

◆ DeRegister()

void G4RegionStore::DeRegister ( G4Region pSolid)
static

Definition at line 142 of file G4RegionStore.cc.

143{
144 if (!locked) // Do not de-register if locked !
145 {
146 if (fgNotifier) { fgNotifier->NotifyDeRegistration(); }
147 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
148 {
149 if (**i==*pRegion)
150 {
151 GetInstance()->erase(i);
152 break;
153 }
154 }
155 }
156}

Referenced by G4Region::~G4Region().

◆ FindOrCreateRegion()

G4Region * G4RegionStore::FindOrCreateRegion ( const G4String name)

Definition at line 240 of file G4RegionStore.cc.

241{
242 G4Region* target = GetRegion(name,false);
243 if (!target)
244 {
245 target = new G4Region(name);
246 }
247 return target;
248}
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const

◆ GetInstance()

◆ GetRegion()

G4Region * G4RegionStore::GetRegion ( const G4String name,
G4bool  verbose = true 
) const

Definition at line 216 of file G4RegionStore.cc.

217{
218 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
219 {
220 if ((*i)->GetName() == name) { return *i; }
221 }
222 if (verbose)
223 {
224 std::ostringstream message;
225 message << "Region NOT found in store !" << G4endl
226 << " Region " << name << " NOT found in store !" << G4endl
227 << " Returning NULL pointer.";
228 G4Exception("G4RegionStore::GetRegion()",
229 "GeomMgt1001", JustWarning, message);
230 }
231 return 0;
232}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by G4EmBiasingManager::ActivateForcedInteraction(), G4EmBiasingManager::ActivateSecondaryBiasing(), G4VEnergyLossProcess::ActivateSubCutoff(), G4ProductionCutsTable::CheckMaterialCutsCoupleInfo(), G4RunManagerKernel::DumpRegion(), G4EmCalculator::FindCouple(), FindOrCreateRegion(), G4EmCalculator::FindRegion(), G4Region::G4Region(), G4EmModelManager::Initialise(), G4VAtomDeexcitation::InitialiseAtomicDeexcitation(), G4VUserPhysicsList::SetCutValue(), and G4MaterialScanner::SetRegionName().

◆ IsModified()

G4bool G4RegionStore::IsModified ( ) const

Definition at line 177 of file G4RegionStore.cc.

178{
179 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
180 {
181 if ((*i)->IsModified()) { return true; }
182 }
183 return false;
184}

◆ Register()

void G4RegionStore::Register ( G4Region pSolid)
static

Definition at line 132 of file G4RegionStore.cc.

133{
134 GetInstance()->push_back(pRegion);
135 if (fgNotifier) { fgNotifier->NotifyRegistration(); }
136}
virtual void NotifyRegistration()=0

Referenced by G4Region::G4Region().

◆ ResetRegionModified()

void G4RegionStore::ResetRegionModified ( )

Definition at line 191 of file G4RegionStore.cc.

192{
193 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
194 {
195 (*i)->RegionModified(false);
196 }
197}

◆ SetNotifier()

void G4RegionStore::SetNotifier ( G4VStoreNotifier pNotifier)
static

Definition at line 122 of file G4RegionStore.cc.

123{
124 GetInstance();
125 fgNotifier = pNotifier;
126}

◆ SetWorldVolume()

void G4RegionStore::SetWorldVolume ( )

Definition at line 255 of file G4RegionStore.cc.

256{
257 // Reset all pointers first
258 //
259 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
260 { (*i)->SetWorld(0); }
261
262 // Find world volumes
263 //
264 G4PhysicalVolumeStore* fPhysicalVolumeStore
266 size_t nPhys = fPhysicalVolumeStore->size();
267 for(size_t iPhys=0; iPhys<nPhys; iPhys++)
268 {
269 G4VPhysicalVolume* fPhys = (*fPhysicalVolumeStore)[iPhys];
270 if(fPhys->GetMotherLogical()) { continue; } // not a world volume
271
272 // Now 'fPhys' is a world volume, set it to regions that belong to it.
273 //
274 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
275 { (*i)->SetWorld(fPhys); }
276 }
277}
static G4PhysicalVolumeStore * GetInstance()
G4LogicalVolume * GetMotherLogical() const

◆ UpdateMaterialList()

void G4RegionStore::UpdateMaterialList ( G4VPhysicalVolume currentWorld = 0)

Definition at line 203 of file G4RegionStore.cc.

204{
205 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
206 {
207 if((*i)->IsInMassGeometry() || (*i)->IsInParallelGeometry() || currentWorld)
208 { (*i)->UpdateMaterialList(); }
209 }
210}

Referenced by G4TheRayTracer::CreateBitMap(), and G4RunManagerKernel::UpdateRegion().


The documentation for this class was generated from the following files: