Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RegionStore Class Reference

#include <G4RegionStore.hh>

Inheritance diagram for G4RegionStore:
Collaboration 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 *pRegion)
 
static void DeRegister (G4Region *pRegion)
 
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.

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

Here is the call graph for this function:

Member Function Documentation

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

Here is the call graph for this function:

Here is the caller graph for this function:

void G4RegionStore::DeRegister ( G4Region pRegion)
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 }
virtual void NotifyDeRegistration()=0
static G4RegionStore * GetInstance()

Here is the call graph for this function:

Here is the caller graph for this function:

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
const XML_Char * target
Definition: expat.h:268

Here is the call graph for this function:

G4RegionStore * G4RegionStore::GetInstance ( void  )
static

Definition at line 162 of file G4RegionStore.cc.

163 {
164  static G4RegionStore worldStore;
165  if (!fgInstance)
166  {
167  fgInstance = &worldStore;
168  }
169  return fgInstance;
170 }

Here is the caller graph for this function:

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 }
const XML_Char * name
Definition: expat.h:151
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

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
static G4RegionStore * GetInstance()

Here is the call graph for this function:

void G4RegionStore::Register ( G4Region pRegion)
static

Definition at line 132 of file G4RegionStore.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
static G4RegionStore * GetInstance()

Here is the call graph for this function:

void G4RegionStore::SetNotifier ( G4VStoreNotifier pNotifier)
static

Definition at line 122 of file G4RegionStore.cc.

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

Here is the call graph for this function:

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()
static G4RegionStore * GetInstance()
G4LogicalVolume * GetMotherLogical() const

Here is the call graph for this function:

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 }
static G4RegionStore * GetInstance()

Here is the call graph for this function:

Here is the caller graph for this function:


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