Geant4  10.02.p03
G4tgrMaterialFactory Class Reference

#include <G4tgrMaterialFactory.hh>

Collaboration diagram for G4tgrMaterialFactory:

Public Member Functions

 ~G4tgrMaterialFactory ()
 
G4tgrIsotope * AddIsotope (const std::vector< G4String > &wl)
 
G4tgrElementSimple * AddElementSimple (const std::vector< G4String > &wl)
 
G4tgrElementFromIsotopes * AddElementFromIsotopes (const std::vector< G4String > &wl)
 
G4tgrMaterialSimple * AddMaterialSimple (const std::vector< G4String > &wl)
 
G4tgrMaterialMixture * AddMaterialMixture (const std::vector< G4String > &wl, const G4String &mixtType)
 
G4tgrIsotope * FindIsotope (const G4String &name) const
 
G4tgrElement * FindElement (const G4String &name) const
 
G4tgrMaterial * FindMaterial (const G4String &name) const
 
void DumpIsotopeList () const
 
void DumpElementList () const
 
void DumpMaterialList () const
 
const G4mstgrisot & GetIsotopeList () const
 
const G4mstgrelem & GetElementList () const
 
const G4mstgrmate & GetMaterialList () const
 

Static Public Member Functions

static G4tgrMaterialFactory * GetInstance ()
 

Private Member Functions

 G4tgrMaterialFactory ()
 
void ErrorAlreadyExists (const G4String &object, const std::vector< G4String > &wl, const G4bool bNoRepeating=true)
 

Private Attributes

G4mstgrisot theG4tgrIsotopes
 
G4mstgrelem theG4tgrElements
 
G4mstgrmate theG4tgrMaterials
 

Static Private Attributes

static G4ThreadLocal G4tgrMaterialFactory * theInstance = 0
 

Detailed Description

Definition at line 58 of file G4tgrMaterialFactory.hh.

Constructor & Destructor Documentation

◆ ~G4tgrMaterialFactory()

G4tgrMaterialFactory::~G4tgrMaterialFactory ( )

Definition at line 67 of file G4tgrMaterialFactory.cc.

68 {
69  G4mstgrisot::iterator isotcite;
70  for( isotcite = theG4tgrIsotopes.begin();
71  isotcite != theG4tgrIsotopes.end(); isotcite++)
72  {
73  delete (*isotcite).second;
74  }
75  theG4tgrIsotopes.clear();
76 
77  G4mstgrelem::iterator elemcite;
78  for( elemcite = theG4tgrElements.begin();
79  elemcite != theG4tgrElements.end(); elemcite++)
80  {
81  delete (*elemcite).second;
82  }
83  theG4tgrElements.clear();
84 
85  G4mstgrmate::iterator matcite;
86  for( matcite = theG4tgrMaterials.begin();
87  matcite != theG4tgrMaterials.end(); matcite++)
88  {
89  delete (*matcite).second;
90  }
91  theG4tgrMaterials.clear();
92  delete theInstance;
93 }
static G4ThreadLocal G4tgrMaterialFactory * theInstance

◆ G4tgrMaterialFactory()

G4tgrMaterialFactory::G4tgrMaterialFactory ( )
private

Definition at line 50 of file G4tgrMaterialFactory.cc.

51 {
52 }
Here is the caller graph for this function:

Member Function Documentation

◆ AddElementFromIsotopes()

G4tgrElementFromIsotopes * G4tgrMaterialFactory::AddElementFromIsotopes ( const std::vector< G4String > &  wl)

Definition at line 131 of file G4tgrMaterialFactory.cc.

132 {
133  //---------- Look if element exists
134  if( FindElement( G4tgrUtils::GetString(wl[1]) ) != 0 )
135  {
136  ErrorAlreadyExists("element", wl );
137  }
138 
140  theG4tgrElements[elem->GetName()] = elem;
141 
142  return elem;
143 }
const G4String & GetName() const
Definition: G4tgrElement.hh:52
G4tgrElement * FindElement(const G4String &name) const
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
void ErrorAlreadyExists(const G4String &object, const std::vector< G4String > &wl, const G4bool bNoRepeating=true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddElementSimple()

G4tgrElementSimple * G4tgrMaterialFactory::AddElementSimple ( const std::vector< G4String > &  wl)

Definition at line 114 of file G4tgrMaterialFactory.cc.

115 {
116  //---------- Look if element exists
117  if( FindElement( G4tgrUtils::GetString(wl[1]) ) != 0 )
118  {
119  ErrorAlreadyExists("element", wl );
120  }
121 
122  G4tgrElementSimple* elem = new G4tgrElementSimple( wl );
123  theG4tgrElements[elem->GetName()] = elem;
124 
125  return elem;
126 }
const G4String & GetName() const
Definition: G4tgrElement.hh:52
G4tgrElement * FindElement(const G4String &name) const
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
void ErrorAlreadyExists(const G4String &object, const std::vector< G4String > &wl, const G4bool bNoRepeating=true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddIsotope()

G4tgrIsotope * G4tgrMaterialFactory::AddIsotope ( const std::vector< G4String > &  wl)

Definition at line 98 of file G4tgrMaterialFactory.cc.

99 {
100  //---------- Look if isotope exists
101  if( FindIsotope( G4tgrUtils::GetString(wl[1]) ) != 0 )
102  {
103  ErrorAlreadyExists("isotope", wl );
104  }
105 
106  G4tgrIsotope* isot = new G4tgrIsotope( wl );
107  theG4tgrIsotopes[isot->GetName()] = isot;
108 
109  return isot;
110 }
G4tgrIsotope * FindIsotope(const G4String &name) const
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
void ErrorAlreadyExists(const G4String &object, const std::vector< G4String > &wl, const G4bool bNoRepeating=true)
const G4String & GetName() const
Definition: G4tgrIsotope.hh:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddMaterialMixture()

G4tgrMaterialMixture * G4tgrMaterialFactory::AddMaterialMixture ( const std::vector< G4String > &  wl,
const G4String &  mixtType 
)

Definition at line 174 of file G4tgrMaterialFactory.cc.

176 {
177 #ifdef G4VERBOSE
179  {
180  G4cout << " G4tgrMaterialFactory::AddMaterialMixture " << wl[1] << G4endl;
181  }
182 #endif
183 
184  //---------- Look if material already exists
185  if( FindMaterial( G4tgrUtils::GetString(wl[1]) ) != 0 )
186  {
187  ErrorAlreadyExists("material mixture", wl );
188  }
189 
190  G4tgrMaterialMixture* mate;
191  mate = new G4tgrMaterialMixture( mixtType, wl );
192 
193  //---------- register this material
194  theG4tgrMaterials[ mate->GetName() ] = mate;
195 
196  return mate;
197 }
const G4String & GetName() const
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
#define G4endl
Definition: G4ios.hh:61
G4tgrMaterial * FindMaterial(const G4String &name) const
void ErrorAlreadyExists(const G4String &object, const std::vector< G4String > &wl, const G4bool bNoRepeating=true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddMaterialSimple()

G4tgrMaterialSimple * G4tgrMaterialFactory::AddMaterialSimple ( const std::vector< G4String > &  wl)

Definition at line 148 of file G4tgrMaterialFactory.cc.

149 {
150 #ifdef G4VERBOSE
152  {
153  G4cout << " G4tgrMaterialFactory::AddMaterialSimple" << wl[1] << G4endl;
154  }
155 #endif
156 
157  //---------- Look if material exists
158  if( FindMaterial( G4tgrUtils::GetString(wl[1]) ) != 0 )
159  {
160  ErrorAlreadyExists("material simple", wl );
161  }
162 
163  G4tgrMaterialSimple* mate = new G4tgrMaterialSimple("MaterialSimple", wl );
164 
165  //---------- register this material
166  theG4tgrMaterials[ mate->GetName() ] = mate;
167 
168  return mate;
169 }
const G4String & GetName() const
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
#define G4endl
Definition: G4ios.hh:61
G4tgrMaterial * FindMaterial(const G4String &name) const
void ErrorAlreadyExists(const G4String &object, const std::vector< G4String > &wl, const G4bool bNoRepeating=true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpElementList()

void G4tgrMaterialFactory::DumpElementList ( ) const

Definition at line 295 of file G4tgrMaterialFactory.cc.

296 {
297  G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrElement's List " << G4endl;
298  G4mstgrelem::const_iterator cite;
299  for(cite = theG4tgrElements.begin(); cite != theG4tgrElements.end(); cite++)
300  {
301  G4cout << " ELEM: " << (*cite).second->GetName() << G4endl;
302  }
303 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

◆ DumpIsotopeList()

void G4tgrMaterialFactory::DumpIsotopeList ( ) const

Definition at line 283 of file G4tgrMaterialFactory.cc.

284 {
285  G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrIsotope's List " << G4endl;
286  G4mstgrisot::const_iterator cite;
287  for(cite = theG4tgrIsotopes.begin(); cite != theG4tgrIsotopes.end(); cite++)
288  {
289  G4cout << " ISOT: " << (*cite).second->GetName() << G4endl;
290  }
291 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

◆ DumpMaterialList()

void G4tgrMaterialFactory::DumpMaterialList ( ) const

Definition at line 307 of file G4tgrMaterialFactory.cc.

308 {
309  G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrMaterial's List " << G4endl;
310  G4mstgrmate::const_iterator cite;
311  for(cite = theG4tgrMaterials.begin(); cite != theG4tgrMaterials.end(); cite++)
312  {
313  G4tgrMaterial* mate = (*cite).second;
314  G4cout << " MATE: " << mate->GetName() << " Type: " << mate->GetType()
315  << " NoComponents= " << mate->GetNumberOfComponents() << G4endl;
316  }
317 }
const G4String & GetName() const
const G4String & GetType() const
G4int GetNumberOfComponents() const
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ErrorAlreadyExists()

void G4tgrMaterialFactory::ErrorAlreadyExists ( const G4String &  object,
const std::vector< G4String > &  wl,
const G4bool  bNoRepeating = true 
)
private

Definition at line 322 of file G4tgrMaterialFactory.cc.

324 {
325  G4String msg = object + G4String(" repeated");
326  if( bNoRepeating )
327  {
328  G4tgrUtils::DumpVS( wl, (G4String("!!!! EXITING: ") + msg).c_str() );
329  G4Exception("G4tgrMaterialFactory", "FatalError",
330  FatalException, "Aborting...");
331  }
332  else
333  {
334 #ifdef G4VERBOSE
336  {
337  G4tgrUtils::DumpVS( wl, (G4String("!! WARNING: ") + msg).c_str() );
338  }
339 #endif
340  }
341 }
static G4int GetVerboseLevel()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static void DumpVS(const std::vector< G4String > &wl, const char *msg)
Definition: G4tgrUtils.cc:158
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindElement()

G4tgrElement * G4tgrMaterialFactory::FindElement ( const G4String &  name) const

Definition at line 231 of file G4tgrMaterialFactory.cc.

232 {
233 #ifdef G4VERBOSE
235  {
236  G4cout << " G4tgrMaterialFactory::FindElement() - " << name << G4endl;
237  }
238 #endif
239  G4mstgrelem::const_iterator cite;
240  cite = theG4tgrElements.find( name );
241  if( cite == theG4tgrElements.end() )
242  {
243  return 0;
244  }
245  else
246  {
247 #ifdef G4VERBOSE
249  {
250  DumpElementList();
251  G4cout << " G4tgrElement found: "
252  << ( (*cite).second )->GetName() << G4endl;
253  }
254 #endif
255  return (*cite).second;
256  }
257 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindIsotope()

G4tgrIsotope * G4tgrMaterialFactory::FindIsotope ( const G4String &  name) const

Definition at line 201 of file G4tgrMaterialFactory.cc.

202 {
203 #ifdef G4VERBOSE
205  {
206  G4cout << " G4tgrMaterialFactory::FindIsotope() - " << name << G4endl;
207  }
208 #endif
209 
210  G4mstgrisot::const_iterator cite;
211  cite = theG4tgrIsotopes.find( name );
212  if( cite == theG4tgrIsotopes.end() )
213  {
214  return 0;
215  }
216  else
217  {
218 #ifdef G4VERBOSE
220  {
221  G4cout << " G4tgrIsotope found: "
222  << ( (*cite).second )->GetName() << G4endl;
223  }
224 #endif
225  return (*cite).second;
226  }
227 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindMaterial()

G4tgrMaterial * G4tgrMaterialFactory::FindMaterial ( const G4String &  name) const

Definition at line 261 of file G4tgrMaterialFactory.cc.

262 {
263 #ifdef G4VERBOSE
265  {
266  G4cout << " G4tgrMaterialFactory::FindMaterial() - " << name << G4endl;
267  }
268 #endif
269  G4mstgrmate::const_iterator cite;
270  cite = theG4tgrMaterials.find( name );
271  if( cite == theG4tgrMaterials.end() )
272  {
273  return 0;
274  }
275  else
276  {
277  return (*cite).second;
278  }
279 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetElementList()

const G4mstgrelem& G4tgrMaterialFactory::GetElementList ( ) const
inline

Definition at line 101 of file G4tgrMaterialFactory.hh.

101 {return theG4tgrElements; }
Here is the caller graph for this function:

◆ GetInstance()

G4tgrMaterialFactory * G4tgrMaterialFactory::GetInstance ( void  )
static

Definition at line 56 of file G4tgrMaterialFactory.cc.

57 {
58  if( !theInstance )
59  {
61  }
62  return theInstance;
63 }
static G4ThreadLocal G4tgrMaterialFactory * theInstance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetIsotopeList()

const G4mstgrisot& G4tgrMaterialFactory::GetIsotopeList ( ) const
inline

Definition at line 100 of file G4tgrMaterialFactory.hh.

100 {return theG4tgrIsotopes; }
Here is the caller graph for this function:

◆ GetMaterialList()

const G4mstgrmate& G4tgrMaterialFactory::GetMaterialList ( ) const
inline

Definition at line 102 of file G4tgrMaterialFactory.hh.

102 {return theG4tgrMaterials;}
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ theG4tgrElements

G4mstgrelem G4tgrMaterialFactory::theG4tgrElements
private

Definition at line 118 of file G4tgrMaterialFactory.hh.

◆ theG4tgrIsotopes

G4mstgrisot G4tgrMaterialFactory::theG4tgrIsotopes
private

Definition at line 116 of file G4tgrMaterialFactory.hh.

◆ theG4tgrMaterials

G4mstgrmate G4tgrMaterialFactory::theG4tgrMaterials
private

Definition at line 120 of file G4tgrMaterialFactory.hh.

◆ theInstance

G4ThreadLocal G4tgrMaterialFactory * G4tgrMaterialFactory::theInstance = 0
staticprivate

Definition at line 114 of file G4tgrMaterialFactory.hh.


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