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

#include <G4PhysicalVolumeStore.hh>

Inheritance diagram for G4PhysicalVolumeStore:
Collaboration diagram for G4PhysicalVolumeStore:

Public Member Functions

G4VPhysicalVolumeGetVolume (const G4String &name, G4bool verbose=true) const
 
virtual ~G4PhysicalVolumeStore ()
 

Static Public Member Functions

static void Register (G4VPhysicalVolume *pSolid)
 
static void DeRegister (G4VPhysicalVolume *pSolid)
 
static G4PhysicalVolumeStoreGetInstance ()
 
static void SetNotifier (G4VStoreNotifier *pNotifier)
 
static void Clean ()
 

Protected Member Functions

 G4PhysicalVolumeStore ()
 

Detailed Description

Definition at line 62 of file G4PhysicalVolumeStore.hh.

Constructor & Destructor Documentation

G4PhysicalVolumeStore::~G4PhysicalVolumeStore ( )
virtual

Definition at line 65 of file G4PhysicalVolumeStore.cc.

66 {
67  Clean();
68 }

Here is the call graph for this function:

G4PhysicalVolumeStore::G4PhysicalVolumeStore ( )
protected

Definition at line 55 of file G4PhysicalVolumeStore.cc.

56  : std::vector<G4VPhysicalVolume*>()
57 {
58  reserve(100);
59 }

Member Function Documentation

void G4PhysicalVolumeStore::Clean ( )
static

Definition at line 74 of file G4PhysicalVolumeStore.cc.

75 {
76  // Do nothing if geometry is closed
77  //
78  if (G4GeometryManager::GetInstance()->IsGeometryClosed())
79  {
80  G4cout << "WARNING - Attempt to delete the physical volume store"
81  << " while geometry closed !" << G4endl;
82  return;
83  }
84 
85  // Locks store for deletion of volumes. De-registration will be
86  // performed at this stage. G4VPhysicalVolumes will not de-register
87  // themselves.
88  //
89  locked = true;
90 
91  size_t i=0;
93  std::vector<G4VPhysicalVolume*>::iterator pos;
94 
95 #ifdef G4GEOMETRY_VOXELDEBUG
96  G4cout << "Deleting Physical Volumes ... ";
97 #endif
98 
99  for(pos=store->begin(); pos!=store->end(); pos++)
100  {
101  if (fgNotifier) { fgNotifier->NotifyDeRegistration(); }
102  if (*pos) { delete *pos; }
103  i++;
104  }
105 
106 #ifdef G4GEOMETRY_VOXELDEBUG
107  if (store->size() < i-1)
108  { G4cout << "No volumes deleted. Already deleted by user ?" << G4endl; }
109  else
110  { G4cout << i-1 << " volumes deleted !" << G4endl; }
111 #endif
112 
113  locked = false;
114  store->clear();
115 }
virtual void NotifyDeRegistration()=0
static G4PhysicalVolumeStore * 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 G4PhysicalVolumeStore::DeRegister ( G4VPhysicalVolume pSolid)
static

Definition at line 142 of file G4PhysicalVolumeStore.cc.

143 {
144  if (!locked) // Do not de-register if locked !
145  {
146  if (fgNotifier) { fgNotifier->NotifyDeRegistration(); }
147  G4LogicalVolume* motherLogical = pVolume->GetMotherLogical();
148  if (motherLogical) { motherLogical->RemoveDaughter(pVolume); }
149  for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
150  {
151  if (**i==*pVolume)
152  {
153  GetInstance()->erase(i);
154  break;
155  }
156  }
157  }
158 }
virtual void NotifyDeRegistration()=0
static G4PhysicalVolumeStore * GetInstance()
void RemoveDaughter(const G4VPhysicalVolume *p)

Here is the call graph for this function:

Here is the caller graph for this function:

G4PhysicalVolumeStore * G4PhysicalVolumeStore::GetInstance ( void  )
static

Definition at line 187 of file G4PhysicalVolumeStore.cc.

188 {
189  static G4PhysicalVolumeStore worldStore;
190  if (!fgInstance)
191  {
192  fgInstance = &worldStore;
193  }
194  return fgInstance;
195 }

Here is the caller graph for this function:

G4VPhysicalVolume * G4PhysicalVolumeStore::GetVolume ( const G4String name,
G4bool  verbose = true 
) const

Definition at line 165 of file G4PhysicalVolumeStore.cc.

166 {
167  for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
168  {
169  if ((*i)->GetName() == name) { return *i; }
170  }
171  if (verbose)
172  {
173  std::ostringstream message;
174  message << "Volume NOT found in store !" << G4endl
175  << " Volume " << name << " NOT found in store !" << G4endl
176  << " Returning NULL pointer.";
177  G4Exception("G4PhysicalVolumeStore::GetVolume()",
178  "GeomMgt1001", JustWarning, message);
179  }
180  return 0;
181 }
const XML_Char * name
Definition: expat.h:151
static G4PhysicalVolumeStore * 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:

void G4PhysicalVolumeStore::Register ( G4VPhysicalVolume pSolid)
static

Definition at line 131 of file G4PhysicalVolumeStore.cc.

132 {
133  GetInstance()->push_back(pVolume);
134  if (fgNotifier) { fgNotifier->NotifyRegistration(); }
135 }
static G4PhysicalVolumeStore * GetInstance()
virtual void NotifyRegistration()=0

Here is the call graph for this function:

Here is the caller graph for this function:

void G4PhysicalVolumeStore::SetNotifier ( G4VStoreNotifier pNotifier)
static

Definition at line 121 of file G4PhysicalVolumeStore.cc.

122 {
123  GetInstance();
124  fgNotifier = pNotifier;
125 }
static G4PhysicalVolumeStore * GetInstance()

Here is the call graph for this function:


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