Geant4 10.7.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 ()
 
virtual ~G4RegionStore ()
 
 G4RegionStore (const G4RegionStore &)=delete
 
G4RegionStoreoperator= (const G4RegionStore &)=delete
 

Static Public Member Functions

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

Protected Member Functions

 G4RegionStore ()
 

Detailed Description

Definition at line 59 of file G4RegionStore.hh.

Constructor & Destructor Documentation

◆ ~G4RegionStore()

G4RegionStore::~G4RegionStore ( )
virtual

Definition at line 62 of file G4RegionStore.cc.

63{
64 Clean(); // Delete all regions in the store
65 G4Region::Clean(); // Delete allocated sub-instance data
66}
static void Clean()
static void Clean()
Definition: G4Region.cc:346

◆ G4RegionStore() [1/2]

G4RegionStore::G4RegionStore ( const G4RegionStore )
delete

◆ G4RegionStore() [2/2]

G4RegionStore::G4RegionStore ( )
protected

Definition at line 52 of file G4RegionStore.cc.

53 : std::vector<G4Region*>()
54{
55 reserve(20);
56}

Member Function Documentation

◆ Clean()

void G4RegionStore::Clean ( )
static

Definition at line 72 of file G4RegionStore.cc.

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

Referenced by ~G4RegionStore().

◆ DeRegister()

void G4RegionStore::DeRegister ( G4Region pRegion)
static

Definition at line 136 of file G4RegionStore.cc.

137{
138 if (!locked) // Do not de-register if locked !
139 {
140 if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
141 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
142 {
143 if (**i==*pRegion)
144 {
145 GetInstance()->erase(i);
146 break;
147 }
148 }
149 }
150}

Referenced by G4Region::~G4Region().

◆ FindOrCreateRegion()

G4Region * G4RegionStore::FindOrCreateRegion ( const G4String name)

Definition at line 235 of file G4RegionStore.cc.

236{
237 G4Region* target = GetRegion(name,false);
238 if (target == nullptr)
239 {
240 target = new G4Region(name);
241 }
242 return target;
243}
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const

◆ GetInstance()

G4RegionStore * G4RegionStore::GetInstance ( )
static

◆ GetRegion()

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

Definition at line 211 of file G4RegionStore.cc.

212{
213 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
214 {
215 if ((*i)->GetName() == name) { return *i; }
216 }
217 if (verbose)
218 {
219 std::ostringstream message;
220 message << "Region NOT found in store !" << G4endl
221 << " Region " << name << " NOT found in store !" << G4endl
222 << " Returning NULL pointer.";
223 G4Exception("G4RegionStore::GetRegion()",
224 "GeomMgt1001", JustWarning, message);
225 }
226 return 0;
227}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
const char * name(G4int ptype)

Referenced by G4EmBiasingManager::ActivateForcedInteraction(), G4EmBiasingManager::ActivateSecondaryBiasing(), G4VEnergyLossProcess::ActivateSubCutoff(), G4LowECapture::BuildPhysicsTable(), G4ProductionCutsTable::CheckMaterialCutsCoupleInfo(), G4EmExtraParameters::DefineRegParamForLoss(), G4RunManagerKernel::DumpRegion(), FindOrCreateRegion(), G4EmCalculator::FindRegion(), G4Region::G4Region(), G4RunManagerKernel::G4RunManagerKernel(), G4VUserPhysicsList::GetCutValue(), G4EmModelManager::Initialise(), G4VAtomDeexcitation::InitialiseAtomicDeexcitation(), G4VUserPhysicsList::SetCutValue(), G4ScoringProbe::SetMaterial(), G4VUserPhysicsList::SetParticleCuts(), G4MaterialScanner::SetRegionName(), and G4ScoringProbe::SetupGeometry().

◆ IsModified()

G4bool G4RegionStore::IsModified ( ) const

Definition at line 171 of file G4RegionStore.cc.

172{
173 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
174 {
175 if ((*i)->IsModified()) { return true; }
176 }
177 return false;
178}

◆ operator=()

G4RegionStore & G4RegionStore::operator= ( const G4RegionStore )
delete

◆ Register()

void G4RegionStore::Register ( G4Region pRegion)
static

Definition at line 126 of file G4RegionStore.cc.

127{
128 GetInstance()->push_back(pRegion);
129 if (fgNotifier) { fgNotifier->NotifyRegistration(); }
130}
virtual void NotifyRegistration()=0

Referenced by G4Region::G4Region().

◆ ResetRegionModified()

void G4RegionStore::ResetRegionModified ( )

Definition at line 185 of file G4RegionStore.cc.

186{
187 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
188 {
189 (*i)->RegionModified(false);
190 }
191}

◆ SetNotifier()

void G4RegionStore::SetNotifier ( G4VStoreNotifier pNotifier)
static

Definition at line 116 of file G4RegionStore.cc.

117{
118 GetInstance();
119 fgNotifier = pNotifier;
120}

◆ SetWorldVolume()

void G4RegionStore::SetWorldVolume ( )

Definition at line 250 of file G4RegionStore.cc.

251{
252 // Reset all pointers first
253 //
254 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
255 { (*i)->SetWorld(nullptr); }
256
257 // Find world volumes
258 //
259 G4PhysicalVolumeStore* fPhysicalVolumeStore
261 size_t nPhys = fPhysicalVolumeStore->size();
262 for(size_t iPhys=0; iPhys<nPhys; ++iPhys)
263 {
264 G4VPhysicalVolume* fPhys = (*fPhysicalVolumeStore)[iPhys];
265 if(fPhys->GetMotherLogical() != nullptr) { continue; } // not a world volume
266
267 // Now 'fPhys' is a world volume, set it to regions that belong to it.
268 //
269 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
270 { (*i)->SetWorld(fPhys); }
271 }
272}
static G4PhysicalVolumeStore * GetInstance()
G4LogicalVolume * GetMotherLogical() const

◆ UpdateMaterialList()

void G4RegionStore::UpdateMaterialList ( G4VPhysicalVolume currentWorld = 0)

Definition at line 197 of file G4RegionStore.cc.

198{
199 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
200 {
201 if((*i)->IsInMassGeometry() || (*i)->IsInParallelGeometry()
202 || (currentWorld != nullptr))
203 { (*i)->UpdateMaterialList(); }
204 }
205}

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


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