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

#include <G4SolidStore.hh>

Inheritance diagram for G4SolidStore:
Collaboration diagram for G4SolidStore:

Public Member Functions

G4VSolidGetSolid (const G4String &name, G4bool verbose=true) const
 
virtual ~G4SolidStore ()
 

Static Public Member Functions

static void Register (G4VSolid *pSolid)
 
static void DeRegister (G4VSolid *pSolid)
 
static G4SolidStoreGetInstance ()
 
static void SetNotifier (G4VStoreNotifier *pNotifier)
 
static void Clean ()
 

Protected Member Functions

 G4SolidStore ()
 

Detailed Description

Definition at line 62 of file G4SolidStore.hh.

Constructor & Destructor Documentation

G4SolidStore::~G4SolidStore ( )
virtual

Definition at line 64 of file G4SolidStore.cc.

65 {
66  // In multi-threaded mode, since parameterised solids are replicated
67  // by threads, the master thread can not free them when thread private
68  // malloc library is used. May let the master thread to replicate.
69 
70 #ifndef G4MULTITHREADED
71  Clean();
72 #endif
73 }
static void Clean()
Definition: G4SolidStore.cc:79

Here is the call graph for this function:

G4SolidStore::G4SolidStore ( )
protected

Definition at line 54 of file G4SolidStore.cc.

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

Member Function Documentation

void G4SolidStore::Clean ( )
static

Definition at line 79 of file G4SolidStore.cc.

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

Definition at line 144 of file G4SolidStore.cc.

145 {
146  if (!locked) // Do not de-register if locked !
147  {
148  if (fgNotifier) { fgNotifier->NotifyDeRegistration(); }
149  for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
150  {
151  if (**i==*pSolid)
152  {
153  GetInstance()->erase(i);
154  break;
155  }
156  }
157  }
158 }
virtual void NotifyDeRegistration()=0
static G4SolidStore * GetInstance()

Here is the call graph for this function:

Here is the caller graph for this function:

G4SolidStore * G4SolidStore::GetInstance ( void  )
static

Definition at line 185 of file G4SolidStore.cc.

186 {
187  static G4SolidStore worldStore;
188  if (!fgInstance)
189  {
190  fgInstance = &worldStore;
191  }
192  return fgInstance;
193 }

Here is the caller graph for this function:

G4VSolid * G4SolidStore::GetSolid ( const G4String name,
G4bool  verbose = true 
) const

Definition at line 164 of file G4SolidStore.cc.

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

Definition at line 134 of file G4SolidStore.cc.

135 {
136  GetInstance()->push_back(pSolid);
137  if (fgNotifier) { fgNotifier->NotifyRegistration(); }
138 }
static G4SolidStore * GetInstance()
virtual void NotifyRegistration()=0

Here is the call graph for this function:

Here is the caller graph for this function:

void G4SolidStore::SetNotifier ( G4VStoreNotifier pNotifier)
static

Definition at line 124 of file G4SolidStore.cc.

125 {
126  GetInstance();
127  fgNotifier = pNotifier;
128 }
static G4SolidStore * GetInstance()

Here is the call graph for this function:


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