Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4tgrMaterialFactory Class Reference

#include <G4tgrMaterialFactory.hh>

Public Member Functions

G4tgrElementFromIsotopesAddElementFromIsotopes (const std::vector< G4String > &wl)
 
G4tgrElementSimpleAddElementSimple (const std::vector< G4String > &wl)
 
G4tgrIsotopeAddIsotope (const std::vector< G4String > &wl)
 
G4tgrMaterialMixtureAddMaterialMixture (const std::vector< G4String > &wl, const G4String &mixtType)
 
G4tgrMaterialSimpleAddMaterialSimple (const std::vector< G4String > &wl)
 
void DumpElementList () const
 
void DumpIsotopeList () const
 
void DumpMaterialList () const
 
G4tgrElementFindElement (const G4String &name) const
 
G4tgrIsotopeFindIsotope (const G4String &name) const
 
G4tgrMaterialFindMaterial (const G4String &name) const
 
const G4mstgrelemGetElementList () const
 
const G4mstgrisotGetIsotopeList () const
 
const G4mstgrmateGetMaterialList () const
 
 ~G4tgrMaterialFactory ()
 

Static Public Member Functions

static G4tgrMaterialFactoryGetInstance ()
 

Private Member Functions

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

Private Attributes

G4mstgrelem theG4tgrElements
 
G4mstgrisot theG4tgrIsotopes
 
G4mstgrmate theG4tgrMaterials
 

Static Private Attributes

static G4ThreadLocal G4tgrMaterialFactorytheInstance = nullptr
 

Detailed Description

Definition at line 52 of file G4tgrMaterialFactory.hh.

Constructor & Destructor Documentation

◆ ~G4tgrMaterialFactory()

G4tgrMaterialFactory::~G4tgrMaterialFactory ( )

Definition at line 58 of file G4tgrMaterialFactory.cc.

59{
60 for(auto isotcite = theG4tgrIsotopes.cbegin();
61 isotcite != theG4tgrIsotopes.cend(); ++isotcite)
62 {
63 delete(*isotcite).second;
64 }
65 theG4tgrIsotopes.clear();
66
67 for(auto elemcite = theG4tgrElements.cbegin();
68 elemcite != theG4tgrElements.cend(); ++elemcite)
69 {
70 delete(*elemcite).second;
71 }
72 theG4tgrElements.clear();
73
74 for(auto matcite = theG4tgrMaterials.cbegin();
75 matcite != theG4tgrMaterials.cend(); ++matcite)
76 {
77 delete(*matcite).second;
78 }
79 theG4tgrMaterials.clear();
80 delete theInstance;
81}
static G4ThreadLocal G4tgrMaterialFactory * theInstance

References theG4tgrElements, theG4tgrIsotopes, theG4tgrMaterials, and theInstance.

◆ G4tgrMaterialFactory()

G4tgrMaterialFactory::G4tgrMaterialFactory ( )
private

Definition at line 43 of file G4tgrMaterialFactory.cc.

44{
45}

Referenced by GetInstance().

Member Function Documentation

◆ AddElementFromIsotopes()

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

Definition at line 116 of file G4tgrMaterialFactory.cc.

117{
118 //---------- Look if element exists
119 if(FindElement(G4tgrUtils::GetString(wl[1])) != 0)
120 {
121 ErrorAlreadyExists("element", wl);
122 }
123
125 theG4tgrElements[elem->GetName()] = elem;
126
127 return elem;
128}
#define elem(i, j)
G4tgrElement * FindElement(const G4String &name) const
void ErrorAlreadyExists(const G4String &object, const std::vector< G4String > &wl, const G4bool bNoRepeating=true)
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:173

References elem, ErrorAlreadyExists(), FindElement(), G4tgrUtils::GetString(), and theG4tgrElements.

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddElementSimple()

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

Definition at line 100 of file G4tgrMaterialFactory.cc.

101{
102 //---------- Look if element exists
103 if(FindElement(G4tgrUtils::GetString(wl[1])) != 0)
104 {
105 ErrorAlreadyExists("element", wl);
106 }
107
109 theG4tgrElements[elem->GetName()] = elem;
110
111 return elem;
112}

References elem, ErrorAlreadyExists(), FindElement(), G4tgrUtils::GetString(), and theG4tgrElements.

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddIsotope()

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

Definition at line 84 of file G4tgrMaterialFactory.cc.

85{
86 //---------- Look if isotope exists
87 if(FindIsotope(G4tgrUtils::GetString(wl[1])) != 0)
88 {
89 ErrorAlreadyExists("isotope", wl);
90 }
91
92 G4tgrIsotope* isot = new G4tgrIsotope(wl);
93 theG4tgrIsotopes[isot->GetName()] = isot;
94
95 return isot;
96}
const G4String & GetName() const
Definition: G4tgrIsotope.hh:54
G4tgrIsotope * FindIsotope(const G4String &name) const

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

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddMaterialMixture()

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

Definition at line 157 of file G4tgrMaterialFactory.cc.

159{
160#ifdef G4VERBOSE
162 {
163 G4cout << " G4tgrMaterialFactory::AddMaterialMixture " << wl[1] << G4endl;
164 }
165#endif
166
167 //---------- Look if material already exists
168 if(FindMaterial(G4tgrUtils::GetString(wl[1])) != 0)
169 {
170 ErrorAlreadyExists("material mixture", wl);
171 }
172
174 mate = new G4tgrMaterialMixture(mixtType, wl);
175
176 //---------- register this material
177 theG4tgrMaterials[mate->GetName()] = mate;
178
179 return mate;
180}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4tgrMaterial * FindMaterial(const G4String &name) const
const G4String & GetName() const
static G4int GetVerboseLevel()

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

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddMaterialSimple()

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

Definition at line 132 of file G4tgrMaterialFactory.cc.

133{
134#ifdef G4VERBOSE
136 {
137 G4cout << " G4tgrMaterialFactory::AddMaterialSimple" << wl[1] << G4endl;
138 }
139#endif
140
141 //---------- Look if material exists
142 if(FindMaterial(G4tgrUtils::GetString(wl[1])) != 0)
143 {
144 ErrorAlreadyExists("material simple", wl);
145 }
146
147 G4tgrMaterialSimple* mate = new G4tgrMaterialSimple("MaterialSimple", wl);
148
149 //---------- register this material
150 theG4tgrMaterials[mate->GetName()] = mate;
151
152 return mate;
153}

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

Referenced by G4tgrLineProcessor::ProcessLine().

◆ DumpElementList()

void G4tgrMaterialFactory::DumpElementList ( ) const

Definition at line 273 of file G4tgrMaterialFactory.cc.

274{
275 G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrElement's List " << G4endl;
276 for(auto cite = theG4tgrElements.cbegin();
277 cite != theG4tgrElements.cend(); ++cite)
278 {
279 G4cout << " ELEM: " << (*cite).second->GetName() << G4endl;
280 }
281}

References G4cout, G4endl, and theG4tgrElements.

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

◆ DumpIsotopeList()

void G4tgrMaterialFactory::DumpIsotopeList ( ) const

Definition at line 262 of file G4tgrMaterialFactory.cc.

263{
264 G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrIsotope's List " << G4endl;
265 for(auto cite = theG4tgrIsotopes.cbegin();
266 cite != theG4tgrIsotopes.cend(); ++cite)
267 {
268 G4cout << " ISOT: " << (*cite).second->GetName() << G4endl;
269 }
270}

References G4cout, G4endl, and theG4tgrIsotopes.

Referenced by G4tgrVolumeMgr::DumpSummary().

◆ DumpMaterialList()

void G4tgrMaterialFactory::DumpMaterialList ( ) const

Definition at line 284 of file G4tgrMaterialFactory.cc.

285{
286 G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrMaterial's List " << G4endl;
287 for(auto cite = theG4tgrMaterials.cbegin();
288 cite != theG4tgrMaterials.cend(); ++cite)
289 {
290 G4tgrMaterial* mate = (*cite).second;
291 G4cout << " MATE: " << mate->GetName() << " Type: " << mate->GetType()
292 << " NoComponents= " << mate->GetNumberOfComponents() << G4endl;
293 }
294}
const G4String & GetType() const
G4int GetNumberOfComponents() const

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

Referenced by G4tgrVolumeMgr::DumpSummary().

◆ ErrorAlreadyExists()

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

Definition at line 297 of file G4tgrMaterialFactory.cc.

300{
301 G4String msg = object + G4String(" repeated");
302 if(bNoRepeating)
303 {
304 G4tgrUtils::DumpVS(wl, (G4String("!!!! EXITING: ") + msg).c_str());
305 G4Exception("G4tgrMaterialFactory", "FatalError", FatalException,
306 "Aborting...");
307 }
308 else
309 {
310#ifdef G4VERBOSE
312 {
313 G4tgrUtils::DumpVS(wl, (G4String("!! WARNING: ") + msg).c_str());
314 }
315#endif
316 }
317}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static void DumpVS(const std::vector< G4String > &wl, const char *msg)
Definition: G4tgrUtils.cc:153

References G4tgrUtils::DumpVS(), FatalException, G4Exception(), and G4tgrMessenger::GetVerboseLevel().

Referenced by AddElementFromIsotopes(), AddElementSimple(), AddIsotope(), AddMaterialMixture(), and AddMaterialSimple().

◆ FindElement()

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

Definition at line 212 of file G4tgrMaterialFactory.cc.

213{
214#ifdef G4VERBOSE
216 {
217 G4cout << " G4tgrMaterialFactory::FindElement() - " << name << G4endl;
218 }
219#endif
220 G4mstgrelem::const_iterator cite;
221 cite = theG4tgrElements.find(name);
222 if(cite == theG4tgrElements.cend())
223 {
224 return nullptr;
225 }
226 else
227 {
228#ifdef G4VERBOSE
230 {
232 G4cout << " G4tgrElement found: " << ((*cite).second)->GetName()
233 << G4endl;
234 }
235#endif
236 return (*cite).second;
237 }
238}
const char * name(G4int ptype)

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

Referenced by AddElementFromIsotopes(), and AddElementSimple().

◆ FindIsotope()

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

Definition at line 183 of file G4tgrMaterialFactory.cc.

184{
185#ifdef G4VERBOSE
187 {
188 G4cout << " G4tgrMaterialFactory::FindIsotope() - " << name << G4endl;
189 }
190#endif
191
192 G4mstgrisot::const_iterator cite;
193 cite = theG4tgrIsotopes.find(name);
194 if(cite == theG4tgrIsotopes.cend())
195 {
196 return nullptr;
197 }
198 else
199 {
200#ifdef G4VERBOSE
202 {
203 G4cout << " G4tgrIsotope found: " << ((*cite).second)->GetName()
204 << G4endl;
205 }
206#endif
207 return (*cite).second;
208 }
209}

References G4cout, G4endl, G4tgrMessenger::GetVerboseLevel(), G4InuclParticleNames::name(), and theG4tgrIsotopes.

Referenced by AddIsotope().

◆ FindMaterial()

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

Definition at line 241 of file G4tgrMaterialFactory.cc.

242{
243#ifdef G4VERBOSE
245 {
246 G4cout << " G4tgrMaterialFactory::FindMaterial() - " << name << G4endl;
247 }
248#endif
249 G4mstgrmate::const_iterator cite;
250 cite = theG4tgrMaterials.find(name);
251 if(cite == theG4tgrMaterials.cend())
252 {
253 return nullptr;
254 }
255 else
256 {
257 return (*cite).second;
258 }
259}

References G4cout, G4endl, G4tgrMessenger::GetVerboseLevel(), G4InuclParticleNames::name(), and theG4tgrMaterials.

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

◆ GetElementList()

const G4mstgrelem & G4tgrMaterialFactory::GetElementList ( ) const
inline

Definition at line 95 of file G4tgrMaterialFactory.hh.

95{ return theG4tgrElements; }

References theG4tgrElements.

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

◆ GetInstance()

G4tgrMaterialFactory * G4tgrMaterialFactory::GetInstance ( )
static

◆ GetIsotopeList()

const G4mstgrisot & G4tgrMaterialFactory::GetIsotopeList ( ) const
inline

Definition at line 94 of file G4tgrMaterialFactory.hh.

94{ return theG4tgrIsotopes; }

References theG4tgrIsotopes.

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

◆ GetMaterialList()

const G4mstgrmate & G4tgrMaterialFactory::GetMaterialList ( ) const
inline

Definition at line 96 of file G4tgrMaterialFactory.hh.

96{ return theG4tgrMaterials; }

References theG4tgrMaterials.

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

Field Documentation

◆ theG4tgrElements

G4mstgrelem G4tgrMaterialFactory::theG4tgrElements
private

◆ theG4tgrIsotopes

G4mstgrisot G4tgrMaterialFactory::theG4tgrIsotopes
private

◆ theG4tgrMaterials

G4mstgrmate G4tgrMaterialFactory::theG4tgrMaterials
private

◆ theInstance

G4ThreadLocal G4tgrMaterialFactory * G4tgrMaterialFactory::theInstance = nullptr
staticprivate

Definition at line 109 of file G4tgrMaterialFactory.hh.

Referenced by GetInstance(), and ~G4tgrMaterialFactory().


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