Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4tgrMaterialFactory Class Reference

#include <G4tgrMaterialFactory.hh>

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 ()
 

Detailed Description

Definition at line 58 of file G4tgrMaterialFactory.hh.

Constructor & Destructor Documentation

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 }

Member Function Documentation

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

Definition at line 131 of file G4tgrMaterialFactory.cc.

References FindElement(), G4tgrElement::GetName(), and G4tgrUtils::GetString().

Referenced by G4tgrLineProcessor::ProcessLine().

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 }
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
const G4String & GetName() const
Definition: G4tgrElement.hh:52
G4tgrElement * FindElement(const G4String &name) const
G4tgrElementSimple * G4tgrMaterialFactory::AddElementSimple ( const std::vector< G4String > &  wl)

Definition at line 114 of file G4tgrMaterialFactory.cc.

References FindElement(), G4tgrElement::GetName(), and G4tgrUtils::GetString().

Referenced by G4tgrLineProcessor::ProcessLine().

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 }
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
const G4String & GetName() const
Definition: G4tgrElement.hh:52
G4tgrElement * FindElement(const G4String &name) const
G4tgrIsotope * G4tgrMaterialFactory::AddIsotope ( const std::vector< G4String > &  wl)

Definition at line 98 of file G4tgrMaterialFactory.cc.

References FindIsotope(), G4tgrIsotope::GetName(), and G4tgrUtils::GetString().

Referenced by G4tgrLineProcessor::ProcessLine().

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
const G4String & GetName() const
Definition: G4tgrIsotope.hh:60
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
G4tgrMaterialMixture * G4tgrMaterialFactory::AddMaterialMixture ( const std::vector< G4String > &  wl,
const G4String &  mixtType 
)

Definition at line 174 of file G4tgrMaterialFactory.cc.

References FindMaterial(), G4cout, G4endl, G4tgrMaterial::GetName(), G4tgrUtils::GetString(), and G4tgrMessenger::GetVerboseLevel().

Referenced by G4tgrLineProcessor::ProcessLine().

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()
G4tgrMaterial * FindMaterial(const G4String &name) const
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
#define G4endl
Definition: G4ios.hh:61
G4tgrMaterialSimple * G4tgrMaterialFactory::AddMaterialSimple ( const std::vector< G4String > &  wl)

Definition at line 148 of file G4tgrMaterialFactory.cc.

References FindMaterial(), G4cout, G4endl, G4tgrMaterial::GetName(), G4tgrUtils::GetString(), and G4tgrMessenger::GetVerboseLevel().

Referenced by G4tgrLineProcessor::ProcessLine().

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()
G4tgrMaterial * FindMaterial(const G4String &name) const
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
#define G4endl
Definition: G4ios.hh:61
void G4tgrMaterialFactory::DumpElementList ( ) const

Definition at line 295 of file G4tgrMaterialFactory.cc.

References G4cout, and G4endl.

Referenced by G4tgrVolumeMgr::DumpSummary(), and FindElement().

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
void G4tgrMaterialFactory::DumpIsotopeList ( ) const

Definition at line 283 of file G4tgrMaterialFactory.cc.

References G4cout, and G4endl.

Referenced by G4tgrVolumeMgr::DumpSummary().

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
void G4tgrMaterialFactory::DumpMaterialList ( ) const

Definition at line 307 of file G4tgrMaterialFactory.cc.

References G4cout, G4endl, G4tgrMaterial::GetName(), G4tgrMaterial::GetNumberOfComponents(), and G4tgrMaterial::GetType().

Referenced by G4tgrVolumeMgr::DumpSummary().

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
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfComponents() const
const G4String & GetType() const
#define G4endl
Definition: G4ios.hh:61
G4tgrElement * G4tgrMaterialFactory::FindElement ( const G4String &  name) const

Definition at line 231 of file G4tgrMaterialFactory.cc.

References DumpElementList(), G4cout, G4endl, and G4tgrMessenger::GetVerboseLevel().

Referenced by AddElementFromIsotopes(), and AddElementSimple().

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
G4tgrIsotope * G4tgrMaterialFactory::FindIsotope ( const G4String &  name) const

Definition at line 201 of file G4tgrMaterialFactory.cc.

References G4cout, G4endl, and G4tgrMessenger::GetVerboseLevel().

Referenced by AddIsotope().

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
G4tgrMaterial * G4tgrMaterialFactory::FindMaterial ( const G4String &  name) const

Definition at line 261 of file G4tgrMaterialFactory.cc.

References G4cout, G4endl, and G4tgrMessenger::GetVerboseLevel().

Referenced by AddMaterialMixture(), AddMaterialSimple(), and G4tgrLineProcessor::ProcessLine().

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
const G4mstgrelem& G4tgrMaterialFactory::GetElementList ( ) const
inline

Definition at line 101 of file G4tgrMaterialFactory.hh.

Referenced by G4tgbMaterialMgr::CopyElements(), and G4tgrVolumeMgr::DumpSummary().

101 {return theG4tgrElements; }
G4tgrMaterialFactory * G4tgrMaterialFactory::GetInstance ( void  )
static

Definition at line 56 of file G4tgrMaterialFactory.cc.

Referenced by G4tgbMaterialMgr::CopyElements(), G4tgbMaterialMgr::CopyIsotopes(), G4tgbMaterialMgr::CopyMaterials(), G4tgrVolumeMgr::DumpSummary(), and G4tgrLineProcessor::ProcessLine().

57 {
58  if( !theInstance )
59  {
60  theInstance = new G4tgrMaterialFactory;
61  }
62  return theInstance;
63 }
const G4mstgrisot& G4tgrMaterialFactory::GetIsotopeList ( ) const
inline

Definition at line 100 of file G4tgrMaterialFactory.hh.

Referenced by G4tgbMaterialMgr::CopyIsotopes(), and G4tgrVolumeMgr::DumpSummary().

100 {return theG4tgrIsotopes; }
const G4mstgrmate& G4tgrMaterialFactory::GetMaterialList ( ) const
inline

Definition at line 102 of file G4tgrMaterialFactory.hh.

Referenced by G4tgbMaterialMgr::CopyMaterials(), and G4tgrVolumeMgr::DumpSummary().

102 {return theG4tgrMaterials;}

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