G4RegionStore Class Reference

#include <G4RegionStore.hh>


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.

00059   : std::vector<G4Region*>()
00060 {
00061   reserve(20);
00062 }

G4RegionStore::~G4RegionStore (  )  [protected, virtual]

Definition at line 68 of file G4RegionStore.cc.

References Clean().

00069 {
00070   Clean();
00071 }


Member Function Documentation

void G4RegionStore::Clean (  )  [static]

Definition at line 77 of file G4RegionStore.cc.

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

Referenced by ~G4RegionStore().

00078 {
00079   // Do nothing if geometry is closed
00080   //
00081   if (G4GeometryManager::GetInstance()->IsGeometryClosed())
00082   {
00083     G4cout << "WARNING - Attempt to delete the region store"
00084            << " while geometry closed !" << G4endl;
00085     return;
00086   }
00087 
00088   // Locks store for deletion of regions. De-registration will be
00089   // performed at this stage. G4Regions will not de-register themselves.
00090   //
00091   locked = true;  
00092 
00093   size_t i=0;
00094   G4RegionStore* store = GetInstance();
00095 
00096 #ifdef G4GEOMETRY_VOXELDEBUG
00097   G4cout << "Deleting Regions ... ";
00098 #endif
00099 
00100   for(iterator pos=store->begin(); pos!=store->end(); ++pos)
00101   {
00102     if (fgNotifier) { fgNotifier->NotifyDeRegistration(); }
00103     if (*pos) { delete *pos; }
00104     i++;
00105   }
00106 
00107 #ifdef G4GEOMETRY_VOXELDEBUG
00108   if (store->size() < i-1)
00109     { G4cout << "No regions deleted. Already deleted by user ?" << G4endl; }
00110   else
00111     { G4cout << i-1 << " regions deleted !" << G4endl; }
00112 #endif
00113 
00114   locked = false;
00115   store->clear();
00116 }

void G4RegionStore::DeRegister ( G4Region pSolid  )  [static]

Definition at line 142 of file G4RegionStore.cc.

References GetInstance().

Referenced by G4Region::~G4Region().

00143 {
00144   if (!locked)    // Do not de-register if locked !
00145   {
00146     if (fgNotifier)  { fgNotifier->NotifyDeRegistration(); }
00147     for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
00148     {
00149       if (**i==*pRegion)
00150       {
00151         GetInstance()->erase(i);
00152         break;
00153       }
00154     }
00155   }
00156 }

G4Region * G4RegionStore::FindOrCreateRegion ( const G4String name  ) 

Definition at line 240 of file G4RegionStore.cc.

References GetRegion().

00241 {
00242   G4Region* target = GetRegion(name,false);
00243   if (!target)
00244   {
00245     target = new G4Region(name);
00246   }
00247   return target;
00248 }

G4RegionStore * G4RegionStore::GetInstance (  )  [static]

Definition at line 162 of file G4RegionStore.cc.

Referenced by G4EmBiasingManager::ActivateForcedInteraction(), G4EmBiasingManager::ActivateSecondaryBiasing(), G4VEnergyLossProcess::ActivateSubCutoff(), Clean(), G4TheRayTracer::CreateBitMap(), DeRegister(), G4RunManagerKernel::DumpRegion(), G4EmCalculator::FindCouple(), G4EmCalculator::FindRegion(), G4ProductionCutsTable::G4ProductionCutsTable(), G4Region::G4Region(), G4VUserPhysicsList::GetCutValue(), GetRegion(), G4EmModelManager::Initialise(), G4VAtomDeexcitation::InitialiseAtomicDeexcitation(), IsModified(), Register(), ResetRegionModified(), G4VUserPhysicsList::SetCutValue(), SetNotifier(), G4VUserPhysicsList::SetParticleCuts(), G4MaterialScanner::SetRegionName(), SetWorldVolume(), G4GlobalFastSimulationManager::ShowSetup(), UpdateMaterialList(), G4RunManagerKernel::UpdateRegion(), and G4Region::~G4Region().

00163 {
00164   static G4RegionStore worldStore;
00165   if (!fgInstance)
00166   {
00167     fgInstance = &worldStore;
00168   }
00169   return fgInstance;
00170 }

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(), G4ProductionCutsTable::CheckMaterialCutsCoupleInfo(), G4RunManagerKernel::DumpRegion(), G4EmCalculator::FindCouple(), FindOrCreateRegion(), G4EmCalculator::FindRegion(), G4Region::G4Region(), G4EmModelManager::Initialise(), G4VAtomDeexcitation::InitialiseAtomicDeexcitation(), G4VUserPhysicsList::SetCutValue(), and G4MaterialScanner::SetRegionName().

00217 {
00218   for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
00219   {
00220     if ((*i)->GetName() == name) { return *i; }
00221   }
00222   if (verbose)
00223   {
00224     std::ostringstream message;
00225     message << "Region NOT found in store !" << G4endl
00226             << "        Region " << name << " NOT found in store !" << G4endl
00227             << "        Returning NULL pointer.";
00228     G4Exception("G4RegionStore::GetRegion()",
00229                 "GeomMgt1001", JustWarning, message);
00230   }
00231   return 0;
00232 }

G4bool G4RegionStore::IsModified (  )  const

Definition at line 177 of file G4RegionStore.cc.

References GetInstance().

00178 {
00179   for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
00180   {
00181     if ((*i)->IsModified()) { return true; }
00182   }
00183   return false;
00184 }

void G4RegionStore::Register ( G4Region pSolid  )  [static]

Definition at line 132 of file G4RegionStore.cc.

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

Referenced by G4Region::G4Region().

00133 {
00134   GetInstance()->push_back(pRegion);
00135   if (fgNotifier)  { fgNotifier->NotifyRegistration(); }
00136 }

void G4RegionStore::ResetRegionModified (  ) 

Definition at line 191 of file G4RegionStore.cc.

References GetInstance().

00192 {
00193   for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
00194   {
00195     (*i)->RegionModified(false);
00196   }
00197 }

void G4RegionStore::SetNotifier ( G4VStoreNotifier pNotifier  )  [static]

Definition at line 122 of file G4RegionStore.cc.

References GetInstance().

00123 {
00124   GetInstance();
00125   fgNotifier = pNotifier;
00126 }

void G4RegionStore::SetWorldVolume (  ) 

Definition at line 255 of file G4RegionStore.cc.

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

00256 {
00257   // Reset all pointers first
00258   //
00259   for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
00260   { (*i)->SetWorld(0); }
00261 
00262   // Find world volumes
00263   //
00264   G4PhysicalVolumeStore* fPhysicalVolumeStore
00265     = G4PhysicalVolumeStore::GetInstance();
00266   size_t nPhys = fPhysicalVolumeStore->size();
00267   for(size_t iPhys=0; iPhys<nPhys; iPhys++)
00268   {
00269     G4VPhysicalVolume* fPhys = (*fPhysicalVolumeStore)[iPhys];
00270     if(fPhys->GetMotherLogical()) { continue; } // not a world volume
00271 
00272     // Now 'fPhys' is a world volume, set it to regions that belong to it.
00273     //
00274     for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
00275     { (*i)->SetWorld(fPhys); }
00276   }
00277 }

void G4RegionStore::UpdateMaterialList ( G4VPhysicalVolume currentWorld = 0  ) 

Definition at line 203 of file G4RegionStore.cc.

References GetInstance().

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

00204 {
00205   for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
00206   {
00207     if((*i)->IsInMassGeometry() || (*i)->IsInParallelGeometry() || currentWorld)
00208     { (*i)->UpdateMaterialList(); }
00209   }
00210 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:16 2013 for Geant4 by  doxygen 1.4.7