Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
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 ( )
protected

Definition at line 58 of file G4RegionStore.cc.

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

Definition at line 68 of file G4RegionStore.cc.

References Clean().

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

Member Function Documentation

void G4RegionStore::Clean ( )
static

Definition at line 77 of file G4RegionStore.cc.

References G4cout, G4endl, GetInstance(), G4GeometryManager::GetInstance(), and G4VNotifier::NotifyDeRegistration().

Referenced by ~G4RegionStore().

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 }
virtual void NotifyDeRegistration()=0
static G4RegionStore * GetInstance()
G4GLOB_DLL std::ostream G4cout
static G4GeometryManager * GetInstance()
#define G4endl
Definition: G4ios.hh:61
void G4RegionStore::DeRegister ( G4Region pSolid)
static

Definition at line 142 of file G4RegionStore.cc.

References GetInstance(), and G4VNotifier::NotifyDeRegistration().

Referenced by G4Region::~G4Region().

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 }
virtual void NotifyDeRegistration()=0
static G4RegionStore * GetInstance()
G4Region * G4RegionStore::FindOrCreateRegion ( const G4String name)

Definition at line 240 of file G4RegionStore.cc.

References GetRegion().

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
const XML_Char * target
G4RegionStore * G4RegionStore::GetInstance ( void  )
static

Definition at line 162 of file G4RegionStore.cc.

Referenced by G4EmBiasingManager::ActivateForcedInteraction(), G4EmBiasingManager::ActivateSecondaryBiasing(), G4VEnergyLossProcess::ActivateSubCutoff(), G4ElectronCapture::BuildPhysicsTable(), ExTGRCRegionCutsMgr::BuildProductionCuts(), G4RunManagerKernel::CheckRegions(), Clean(), RE01DetectorConstruction::Construct(), Par01DetectorConstruction::ConstructSDandField(), G4TheRayTracer::CreateBitMap(), DeRegister(), G4RunManagerKernel::DumpRegion(), RE06RunAction::EndOfRunAction(), G4EmCalculator::FindCouple(), G4EmCalculator::FindRegion(), G4ProductionCutsTable::G4ProductionCutsTable(), G4Region::G4Region(), G4RunManagerKernel::G4RunManagerKernel(), G4VUserPhysicsList::GetCutValue(), GetRegion(), G4EmModelManager::Initialise(), G4VAtomDeexcitation::InitialiseAtomicDeexcitation(), RE06SteppingVerbose::InitializeTimers(), IsModified(), Register(), RE06SteppingVerbose::Report(), ResetRegionModified(), RE06PhysicsList::SetCuts(), ExGflashPhysicsList::SetCuts(), exrdmPhysicsList::SetCuts(), Em10PhysicsList::SetCuts(), G4VUserPhysicsList::SetCutValue(), HadrontherapyPhysicsList::SetDetectorCut(), IORTPhysicsList::SetDetectorCut(), SetNotifier(), G4VUserPhysicsList::SetParticleCuts(), GammaRayTelPhysicsList::SetRegionCut(), G4MaterialScanner::SetRegionName(), SetWorldVolume(), G4GlobalFastSimulationManager::ShowSetup(), GammaRayTelDetectorConstruction::UpdateGeometry(), G4WorkerThread::UpdateGeometryAndPhysicsVectorFromMaster(), UpdateMaterialList(), G4RunManagerKernel::UpdateRegion(), and G4Region::~G4Region().

163 {
164  static G4RegionStore worldStore;
165  if (!fgInstance)
166  {
167  fgInstance = &worldStore;
168  }
169  return fgInstance;
170 }
G4Region * G4RegionStore::GetRegion ( const G4String name,
G4bool  verbose = true 
) const

Definition at line 216 of file G4RegionStore.cc.

References G4endl, G4Exception(), GetInstance(), and JustWarning.

Referenced by G4EmBiasingManager::ActivateForcedInteraction(), G4EmBiasingManager::ActivateSecondaryBiasing(), G4VEnergyLossProcess::ActivateSubCutoff(), ExTGRCRegionCutsMgr::BuildProductionCuts(), G4ProductionCutsTable::CheckMaterialCutsCoupleInfo(), Par01DetectorConstruction::ConstructSDandField(), G4RunManagerKernel::DumpRegion(), RE06RunAction::EndOfRunAction(), FindOrCreateRegion(), G4EmCalculator::FindRegion(), G4Region::G4Region(), G4RunManagerKernel::G4RunManagerKernel(), G4EmModelManager::Initialise(), G4VAtomDeexcitation::InitialiseAtomicDeexcitation(), RE06PhysicsList::SetCuts(), ExGflashPhysicsList::SetCuts(), G4VUserPhysicsList::SetCutValue(), HadrontherapyPhysicsList::SetDetectorCut(), IORTPhysicsList::SetDetectorCut(), GammaRayTelPhysicsList::SetRegionCut(), and G4MaterialScanner::SetRegionName().

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 }
const XML_Char * name
static G4RegionStore * GetInstance()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4bool G4RegionStore::IsModified ( ) const

Definition at line 177 of file G4RegionStore.cc.

References GetInstance().

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

Definition at line 132 of file G4RegionStore.cc.

References GetInstance(), and G4VNotifier::NotifyRegistration().

Referenced by G4Region::G4Region().

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

Definition at line 191 of file G4RegionStore.cc.

References GetInstance().

192 {
193  for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
194  {
195  (*i)->RegionModified(false);
196  }
197 }
static G4RegionStore * GetInstance()
void G4RegionStore::SetNotifier ( G4VStoreNotifier pNotifier)
static

Definition at line 122 of file G4RegionStore.cc.

References GetInstance().

123 {
124  GetInstance();
125  fgNotifier = pNotifier;
126 }
static G4RegionStore * GetInstance()
void G4RegionStore::SetWorldVolume ( )

Definition at line 255 of file G4RegionStore.cc.

References G4PhysicalVolumeStore::GetInstance(), GetInstance(), and G4VPhysicalVolume::GetMotherLogical().

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()
static G4RegionStore * GetInstance()
G4LogicalVolume * GetMotherLogical() const
void G4RegionStore::UpdateMaterialList ( G4VPhysicalVolume currentWorld = 0)

Definition at line 203 of file G4RegionStore.cc.

References GetInstance().

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

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

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