Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
G4GDMLRead Class Referenceabstract

#include <G4GDMLRead.hh>

Inheritance diagram for G4GDMLRead:
G4GDMLReadDefine G4GDMLReadMaterials G4GDMLReadSolids G4GDMLReadSetup G4GDMLReadParamvol G4GDMLReadStructure

Public Member Functions

virtual void DefineRead (const xercesc::DOMElement *const)=0
 
virtual void ExtensionRead (const xercesc::DOMElement *const)
 
const G4GDMLAuxListTypeGetAuxList () const
 
virtual G4String GetSetup (const G4String &)=0
 
virtual G4LogicalVolumeGetVolume (const G4String &) const =0
 
virtual void MaterialsRead (const xercesc::DOMElement *const)=0
 
void OverlapCheck (G4bool)
 
virtual void Paramvol_contentRead (const xercesc::DOMElement *const)=0
 
void Read (const G4String &, G4bool validation, G4bool isModule, G4bool strip=true)
 
virtual void SetupRead (const xercesc::DOMElement *const)=0
 
virtual void SolidsRead (const xercesc::DOMElement *const)=0
 
void StripName (G4String &) const
 
void StripNames () const
 
virtual void StructureRead (const xercesc::DOMElement *const)=0
 
virtual void UserinfoRead (const xercesc::DOMElement *const)
 
virtual void Volume_contentRead (const xercesc::DOMElement *const)=0
 

Protected Member Functions

G4GDMLAuxStructType AuxiliaryRead (const xercesc::DOMElement *const auxElem)
 
 G4GDMLRead ()
 
G4String GenerateName (const G4String &name, G4bool strip=false)
 
void GeneratePhysvolName (const G4String &, G4VPhysicalVolume *)
 
void LoopRead (const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
 
G4String Strip (const G4String &) const
 
G4String Transcode (const XMLCh *const)
 
virtual ~G4GDMLRead ()
 

Protected Attributes

G4bool check = false
 
G4bool dostrip = true
 
G4GDMLEvaluator eval
 
G4bool validate = true
 

Private Attributes

G4GDMLAuxListType auxGlobalList
 
G4int inLoop = 0
 
G4int loopCount = 0
 

Detailed Description

Definition at line 92 of file G4GDMLRead.hh.

Constructor & Destructor Documentation

◆ G4GDMLRead()

G4GDMLRead::G4GDMLRead ( )
protected

Definition at line 43 of file G4GDMLRead.cc.

44{
45 // Make sure units are defined.
47}
static G4UnitsTable & GetUnitsTable()

References G4UnitDefinition::GetUnitsTable().

◆ ~G4GDMLRead()

G4GDMLRead::~G4GDMLRead ( )
protectedvirtual

Definition at line 50 of file G4GDMLRead.cc.

51{
52}

Member Function Documentation

◆ AuxiliaryRead()

G4GDMLAuxStructType G4GDMLRead::AuxiliaryRead ( const xercesc::DOMElement *const  auxElem)
protected

Definition at line 295 of file G4GDMLRead.cc.

297{
298 G4GDMLAuxStructType auxstruct = { "", "", "", 0 };
299 G4GDMLAuxListType* auxList = nullptr;
300
301 const xercesc::DOMNamedNodeMap* const attributes =
302 auxiliaryElement->getAttributes();
303 XMLSize_t attributeCount = attributes->getLength();
304
305 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
306 ++attribute_index)
307 {
308 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
309
310 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
311 {
312 continue;
313 }
314
315 const xercesc::DOMAttr* const attribute =
316 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
317 if(!attribute)
318 {
319 G4Exception("G4GDMLRead::AuxiliaryRead()", "InvalidRead", FatalException,
320 "No attribute found!");
321 return auxstruct;
322 }
323 const G4String attName = Transcode(attribute->getName());
324 const G4String attValue = Transcode(attribute->getValue());
325
326 if(attName == "auxtype")
327 {
328 auxstruct.type = attValue;
329 }
330 else if(attName == "auxvalue")
331 {
332 auxstruct.value = attValue;
333 }
334 else if(attName == "auxunit")
335 {
336 auxstruct.unit = attValue;
337 }
338 }
339
340 for(xercesc::DOMNode* iter = auxiliaryElement->getFirstChild();
341 iter != nullptr; iter = iter->getNextSibling())
342 {
343 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
344 {
345 continue;
346 }
347
348 const xercesc::DOMElement* const child =
349 dynamic_cast<xercesc::DOMElement*>(iter);
350 if(!child)
351 {
352 G4Exception("G4GDMLRead::AuxiliaryRead()", "InvalidRead", FatalException,
353 "No child found!");
354 break;
355 }
356 const G4String tag = Transcode(child->getTagName());
357
358 if(tag == "auxiliary")
359 {
360 if(!auxList)
361 {
362 auxList = new G4GDMLAuxListType;
363 }
364 auxList->push_back(AuxiliaryRead(child));
365 }
366 }
367
368 if(auxList)
369 {
370 auxstruct.auxList = auxList;
371 }
372
373 return auxstruct;
374}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
G4GDMLAuxStructType AuxiliaryRead(const xercesc::DOMElement *const auxElem)
Definition: G4GDMLRead.cc:295
G4String Transcode(const XMLCh *const)
Definition: G4GDMLRead.cc:55
std::vector< G4GDMLAuxStructType > * auxList
Definition: xmlparse.cc:187

References AuxiliaryRead(), G4GDMLAuxStructType::auxList, FatalException, G4Exception(), Transcode(), G4GDMLAuxStructType::type, G4GDMLAuxStructType::unit, and G4GDMLAuxStructType::value.

Referenced by AuxiliaryRead(), UserinfoRead(), and G4GDMLReadStructure::VolumeRead().

◆ DefineRead()

virtual void G4GDMLRead::DefineRead ( const xercesc::DOMElement * const  )
pure virtual

Implemented in G4GDMLReadDefine.

Referenced by Read().

◆ ExtensionRead()

void G4GDMLRead::ExtensionRead ( const xercesc::DOMElement * const  )
virtual

Definition at line 414 of file G4GDMLRead.cc.

415{
416 G4String error_msg = "No handle to user-code for parsing extensions!";
417 G4Exception("G4GDMLRead::ExtensionRead()", "NotImplemented", JustWarning,
418 error_msg);
419}
@ JustWarning

References G4Exception(), and JustWarning.

Referenced by Read().

◆ GenerateName()

G4String G4GDMLRead::GenerateName ( const G4String name,
G4bool  strip = false 
)
protected

Definition at line 70 of file G4GDMLRead.cc.

71{
72 G4String nameOut(nameIn);
73
74 if(inLoop > 0)
75 {
76 nameOut = eval.SolveBrackets(nameOut);
77 }
78 if(strip)
79 {
80 StripName(nameOut);
81 }
82
83 return nameOut;
84}
G4String SolveBrackets(const G4String &)
void StripName(G4String &) const
Definition: G4GDMLRead.cc:112
G4int inLoop
Definition: G4GDMLRead.hh:163
G4GDMLEvaluator eval
Definition: G4GDMLRead.hh:156
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.

References eval, inLoop, G4GDMLEvaluator::SolveBrackets(), G4StrUtil::strip(), and StripName().

Referenced by G4GDMLReadStructure::AssemblyRead(), G4GDMLReadSolids::BooleanRead(), G4GDMLReadStructure::BorderSurfaceRead(), G4GDMLReadSolids::BoxRead(), G4GDMLReadSolids::ConeRead(), G4GDMLReadSolids::CutTubeRead(), G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadSolids::ElconeRead(), G4GDMLReadMaterials::ElementRead(), G4GDMLReadSolids::EllipsoidRead(), G4GDMLReadSolids::EltubeRead(), G4GDMLReadStructure::FileRead(), G4GDMLReadSolids::GenericPolyconeRead(), G4GDMLReadSolids::GenericPolyhedraRead(), G4GDMLReadSolids::GenTrapRead(), G4GDMLReadStructure::GetWorldVolume(), G4GDMLReadSolids::HypeRead(), G4GDMLReadMaterials::IsotopeRead(), G4GDMLReadMaterials::MaterialRead(), G4GDMLReadDefine::MatrixRead(), G4GDMLReadMaterials::MixtureRead(), G4GDMLReadSolids::MultiUnionNodeRead(), G4GDMLReadSolids::MultiUnionRead(), G4GDMLReadSolids::OpticalSurfaceRead(), G4GDMLReadSolids::OrbRead(), G4GDMLReadSolids::ParaboloidRead(), G4GDMLReadParamvol::ParametersRead(), G4GDMLReadParamvol::ParamvolRead(), G4GDMLReadSolids::ParaRead(), G4GDMLReadStructure::PhysvolRead(), G4GDMLReadSolids::PolyconeRead(), G4GDMLReadSolids::PolyhedraRead(), G4GDMLReadDefine::PositionRead(), G4GDMLReadMaterials::PropertyRead(), G4GDMLReadSolids::PropertyRead(), G4GDMLReadSolids::QuadrangularRead(), G4GDMLReadSolids::ReflectedSolidRead(), G4GDMLReadStructure::ReplicaRead(), G4GDMLReadStructure::ReplicavolRead(), G4GDMLReadDefine::RotationRead(), G4GDMLReadSolids::ScaledSolidRead(), G4GDMLReadDefine::ScaleRead(), G4GDMLReadSetup::SetupRead(), G4GDMLReadStructure::SkinSurfaceRead(), G4GDMLReadSolids::SphereRead(), G4GDMLReadSolids::TessellatedRead(), G4GDMLReadSolids::TetRead(), G4GDMLReadSolids::TorusRead(), G4GDMLReadSolids::TrapRead(), G4GDMLReadSolids::TrdRead(), G4GDMLReadSolids::TriangularRead(), G4GDMLReadSolids::TubeRead(), G4GDMLReadSolids::TwistedboxRead(), G4GDMLReadSolids::TwistedtrapRead(), G4GDMLReadSolids::TwistedtrdRead(), G4GDMLReadSolids::TwistedtubsRead(), G4GDMLReadStructure::VolumeRead(), and G4GDMLReadSolids::XtruRead().

◆ GeneratePhysvolName()

void G4GDMLRead::GeneratePhysvolName ( const G4String nameIn,
G4VPhysicalVolume physvol 
)
protected

Definition at line 87 of file G4GDMLRead.cc.

89{
90 G4String nameOut(nameIn);
91
92 if(nameIn.empty())
93 {
94 std::stringstream stream;
95 stream << physvol->GetLogicalVolume()->GetName() << "_PV";
96 nameOut = stream.str();
97 }
98 nameOut = eval.SolveBrackets(nameOut);
99
100 physvol->SetName(nameOut);
101}
const G4String & GetName() const
G4LogicalVolume * GetLogicalVolume() const
void SetName(const G4String &pName)

References eval, G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetName(), G4VPhysicalVolume::SetName(), and G4GDMLEvaluator::SolveBrackets().

Referenced by G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadStructure::PhysvolRead(), and G4GDMLReadStructure::ReplicaRead().

◆ GetAuxList()

const G4GDMLAuxListType * G4GDMLRead::GetAuxList ( ) const

Definition at line 563 of file G4GDMLRead.cc.

564{
565 return &auxGlobalList;
566}
G4GDMLAuxListType auxGlobalList
Definition: G4GDMLRead.hh:164

References auxGlobalList.

◆ GetSetup()

virtual G4String G4GDMLRead::GetSetup ( const G4String )
pure virtual

Implemented in G4GDMLReadSetup.

◆ GetVolume()

virtual G4LogicalVolume * G4GDMLRead::GetVolume ( const G4String ) const
pure virtual

◆ LoopRead()

void G4GDMLRead::LoopRead ( const xercesc::DOMElement * const  element,
void(G4GDMLRead::*)(const xercesc::DOMElement *const)  func 
)
protected

Definition at line 194 of file G4GDMLRead.cc.

196{
197 G4String var;
198 G4String from;
199 G4String to;
200 G4String step;
201
202 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
203 XMLSize_t attributeCount = attributes->getLength();
204
205 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
206 ++attribute_index)
207 {
208 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
209
210 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
211 {
212 continue;
213 }
214
215 const xercesc::DOMAttr* const attribute =
216 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
217 if(!attribute)
218 {
219 G4Exception("G4GDMLRead::LoopRead()", "InvalidRead", FatalException,
220 "No attribute found!");
221 return;
222 }
223 const G4String attribute_name = Transcode(attribute->getName());
224 const G4String attribute_value = Transcode(attribute->getValue());
225
226 if(attribute_name == "for")
227 {
228 var = attribute_value;
229 }
230 else if(attribute_name == "from")
231 {
232 from = attribute_value;
233 }
234 else if(attribute_name == "to")
235 {
236 to = attribute_value;
237 }
238 else if(attribute_name == "step")
239 {
240 step = attribute_value;
241 }
242 }
243
244 if(var.empty())
245 {
246 G4Exception("G4GDMLRead::loopRead()", "InvalidRead", FatalException,
247 "No variable is determined for loop!");
248 }
249
250 if(!eval.IsVariable(var))
251 {
252 G4Exception("G4GDMLRead::loopRead()", "InvalidRead", FatalException,
253 "Variable is not defined in loop!");
254 }
255
256 G4int _var = eval.EvaluateInteger(var);
257 G4int _from = eval.EvaluateInteger(from);
258 G4int _to = eval.EvaluateInteger(to);
259 G4int _step = eval.EvaluateInteger(step);
260
261 if(!from.empty())
262 {
263 _var = _from;
264 }
265
266 if((_from < _to) && (_step <= 0))
267 {
268 G4Exception("G4GDMLRead::loopRead()", "InvalidRead", FatalException,
269 "Infinite loop!");
270 }
271 if((_from > _to) && (_step >= 0))
272 {
273 G4Exception("G4GDMLRead::loopRead()", "InvalidRead", FatalException,
274 "Infinite loop!");
275 }
276
277 ++inLoop;
278
279 while(_var <= _to)
280 {
281 eval.SetVariable(var, _var);
282 (this->*func)(element);
283 _var += _step;
284 ++loopCount;
285 }
286
287 --inLoop;
288 if(!inLoop)
289 {
290 loopCount = 0;
291 }
292}
int G4int
Definition: G4Types.hh:85
void SetVariable(const G4String &, G4double)
G4bool IsVariable(const G4String &) const
G4int EvaluateInteger(const G4String &)
G4int loopCount
Definition: G4GDMLRead.hh:163

References eval, G4GDMLEvaluator::EvaluateInteger(), FatalException, G4Exception(), inLoop, G4GDMLEvaluator::IsVariable(), loopCount, G4GDMLEvaluator::SetVariable(), and Transcode().

Referenced by G4GDMLReadParamvol::ParameterisedRead(), G4GDMLReadParamvol::Paramvol_contentRead(), G4GDMLReadSolids::SolidsRead(), G4GDMLReadStructure::StructureRead(), and G4GDMLReadStructure::Volume_contentRead().

◆ MaterialsRead()

virtual void G4GDMLRead::MaterialsRead ( const xercesc::DOMElement * const  )
pure virtual

Implemented in G4GDMLReadMaterials.

Referenced by Read().

◆ OverlapCheck()

void G4GDMLRead::OverlapCheck ( G4bool  flag)

Definition at line 64 of file G4GDMLRead.cc.

65{
66 check = flag;
67}
G4bool check
Definition: G4GDMLRead.hh:158

References check.

◆ Paramvol_contentRead()

virtual void G4GDMLRead::Paramvol_contentRead ( const xercesc::DOMElement * const  )
pure virtual

◆ Read()

void G4GDMLRead::Read ( const G4String fileName,
G4bool  validation,
G4bool  isModule,
G4bool  strip = true 
)

Definition at line 422 of file G4GDMLRead.cc.

424{
425 dostrip = strip;
426#ifdef G4VERBOSE
427 if(isModule)
428 {
429 G4cout << "G4GDML: Reading module '" << fileName << "'..." << G4endl;
430 }
431 else
432 {
433 G4cout << "G4GDML: Reading '" << fileName << "'..." << G4endl;
434 }
435#endif
436 inLoop = 0;
437 validate = validation;
438
439 xercesc::ErrorHandler* handler = new G4GDMLErrorHandler(!validate);
440 xercesc::XercesDOMParser* parser = new xercesc::XercesDOMParser;
441
442 if(validate)
443 {
444 parser->setValidationScheme(xercesc::XercesDOMParser::Val_Always);
445 }
446 parser->setValidationSchemaFullChecking(validate);
447 parser->setCreateEntityReferenceNodes(false);
448 // Entities will be automatically resolved by Xerces
449
450 parser->setDoNamespaces(true);
451 parser->setDoSchema(validate);
452 parser->setErrorHandler(handler);
453
454 try
455 {
456 parser->parse(fileName.c_str());
457 } catch(const xercesc::XMLException& e)
458 {
459 G4cout << "G4GDML: " << Transcode(e.getMessage()) << G4endl;
460 } catch(const xercesc::DOMException& e)
461 {
462 G4cout << "G4GDML: " << Transcode(e.getMessage()) << G4endl;
463 }
464
465 xercesc::DOMDocument* doc = parser->getDocument();
466
467 if(doc == nullptr)
468 {
469 G4String error_msg = "Unable to open document: " + fileName;
470 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException, error_msg);
471 return;
472 }
473 xercesc::DOMElement* element = doc->getDocumentElement();
474
475 if(element == nullptr )
476 {
477 std::ostringstream message;
478 message << "ERROR - Empty document or unable to validate schema!" << G4endl
479 << " Check Internet connection is ON in case of schema"
480 << G4endl
481 << " validation enabled and location defined as URL in"
482 << G4endl << " the GDML file - " << fileName
483 << " - being imported!" << G4endl
484 << " Otherwise, verify GDML schema server is reachable!";
485 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException, message);
486 return;
487 }
488
489 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
490 iter = iter->getNextSibling())
491 {
492 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
493 {
494 continue;
495 }
496
497 const xercesc::DOMElement* const child =
498 dynamic_cast<xercesc::DOMElement*>(iter);
499 if(child == nullptr)
500 {
501 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException,
502 "No child found!");
503 return;
504 }
505 const G4String tag = Transcode(child->getTagName());
506
507 if(tag == "define")
508 {
509 DefineRead(child);
510 }
511 else if(tag == "materials")
512 {
513 MaterialsRead(child);
514 }
515 else if(tag == "solids")
516 {
517 SolidsRead(child);
518 }
519 else if(tag == "setup")
520 {
521 SetupRead(child);
522 }
523 else if(tag == "structure")
524 {
525 StructureRead(child);
526 }
527 else if(tag == "userinfo")
528 {
529 UserinfoRead(child);
530 }
531 else if(tag == "extension")
532 {
533 ExtensionRead(child);
534 }
535 else
536 {
537 G4String error_msg = "Unknown tag in gdml: " + tag;
538 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException,
539 error_msg);
540 }
541 }
542
543 delete parser;
544 delete handler;
545
546 if(isModule)
547 {
548#ifdef G4VERBOSE
549 G4cout << "G4GDML: Reading module '" << fileName << "' done!" << G4endl;
550#endif
551 }
552 else
553 {
554 G4cout << "G4GDML: Reading '" << fileName << "' done!" << G4endl;
555 if(strip)
556 {
557 StripNames();
558 }
559 }
560}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4bool validate
Definition: G4GDMLRead.hh:157
G4bool dostrip
Definition: G4GDMLRead.hh:159
virtual void SolidsRead(const xercesc::DOMElement *const)=0
virtual void MaterialsRead(const xercesc::DOMElement *const)=0
virtual void UserinfoRead(const xercesc::DOMElement *const)
Definition: G4GDMLRead.cc:377
virtual void SetupRead(const xercesc::DOMElement *const)=0
virtual void ExtensionRead(const xercesc::DOMElement *const)
Definition: G4GDMLRead.cc:414
virtual void DefineRead(const xercesc::DOMElement *const)=0
virtual void StructureRead(const xercesc::DOMElement *const)=0
void StripNames() const
Definition: G4GDMLRead.cc:122

References DefineRead(), dostrip, ExtensionRead(), FatalException, G4cout, G4endl, G4Exception(), inLoop, MaterialsRead(), geant4_check_module_cycles::parser, SetupRead(), SolidsRead(), G4StrUtil::strip(), StripNames(), StructureRead(), Transcode(), UserinfoRead(), and validate.

Referenced by G4GDMLReadStructure::FileRead().

◆ SetupRead()

virtual void G4GDMLRead::SetupRead ( const xercesc::DOMElement * const  )
pure virtual

Implemented in G4GDMLReadSetup.

Referenced by Read().

◆ SolidsRead()

virtual void G4GDMLRead::SolidsRead ( const xercesc::DOMElement * const  )
pure virtual

Implemented in G4GDMLReadSolids.

Referenced by Read(), and G4GDMLReadSolids::SolidsRead().

◆ Strip()

G4String G4GDMLRead::Strip ( const G4String name) const
protected

◆ StripName()

void G4GDMLRead::StripName ( G4String name) const

Definition at line 112 of file G4GDMLRead.cc.

113{
114 auto idx = name.find("0x");
115 if(idx != G4String::npos)
116 {
117 name.erase(idx);
118 }
119}

References G4InuclParticleNames::name().

Referenced by G4GDMLParser::ExportRegions(), GenerateName(), G4GDMLParser::ImportRegions(), Strip(), and StripNames().

◆ StripNames()

void G4GDMLRead::StripNames ( ) const

Definition at line 122 of file G4GDMLRead.cc.

123{
124 // Strips off names of volumes, solids elements and materials from possible
125 // reference pointers or IDs attached to their original identifiers.
126
130 const G4ElementTable* elements = G4Element::GetElementTable();
132
133 G4cout << "Stripping off GDML names of materials, solids and volumes ..."
134 << G4endl;
135
136 G4String sname;
137 std::size_t i;
138
139 // Solids...
140 //
141 for(i = 0; i < solids->size(); ++i)
142 {
143 G4VSolid* psol = (*solids)[i];
144 sname = psol->GetName();
145 StripName(sname);
146 psol->SetName(sname);
147 }
148 solids->UpdateMap();
149
150 // Logical volumes...
151 //
152 for(i = 0; i < lvols->size(); ++i)
153 {
154 G4LogicalVolume* lvol = (*lvols)[i];
155 sname = lvol->GetName();
156 StripName(sname);
157 lvol->SetName(sname);
158 }
159 lvols->UpdateMap();
160
161 // Physical volumes...
162 //
163 for(i = 0; i < pvols->size(); ++i)
164 {
165 G4VPhysicalVolume* pvol = (*pvols)[i];
166 sname = pvol->GetName();
167 StripName(sname);
168 pvol->SetName(sname);
169 }
170 pvols->UpdateMap();
171
172 // Materials...
173 //
174 for(i = 0; i < materials->size(); ++i)
175 {
176 G4Material* pmat = (*materials)[i];
177 sname = pmat->GetName();
178 StripName(sname);
179 pmat->SetName(sname);
180 }
181
182 // Elements...
183 //
184 for(i = 0; i < elements->size(); ++i)
185 {
186 G4Element* pelm = (*elements)[i];
187 sname = pelm->GetName();
188 StripName(sname);
189 pelm->SetName(sname);
190 }
191}
std::vector< G4Element * > G4ElementTable
std::vector< G4Material * > G4MaterialTable
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:397
void SetName(const G4String &name)
Definition: G4Element.hh:215
const G4String & GetName() const
Definition: G4Element.hh:127
static G4LogicalVolumeStore * GetInstance()
void SetName(const G4String &pName)
void SetName(const G4String &name)
Definition: G4Material.hh:285
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:672
const G4String & GetName() const
Definition: G4Material.hh:173
static G4PhysicalVolumeStore * GetInstance()
void UpdateMap()
static G4SolidStore * GetInstance()
const G4String & GetName() const
G4String GetName() const
void SetName(const G4String &name)
Definition: G4VSolid.cc:127

References G4cout, G4endl, G4Element::GetElementTable(), G4LogicalVolumeStore::GetInstance(), G4PhysicalVolumeStore::GetInstance(), G4SolidStore::GetInstance(), G4Material::GetMaterialTable(), G4LogicalVolume::GetName(), G4VPhysicalVolume::GetName(), G4VSolid::GetName(), G4Element::GetName(), G4Material::GetName(), G4VSolid::SetName(), G4Element::SetName(), G4Material::SetName(), G4LogicalVolume::SetName(), G4VPhysicalVolume::SetName(), StripName(), G4LogicalVolumeStore::UpdateMap(), G4PhysicalVolumeStore::UpdateMap(), and G4SolidStore::UpdateMap().

Referenced by Read().

◆ StructureRead()

virtual void G4GDMLRead::StructureRead ( const xercesc::DOMElement * const  )
pure virtual

◆ Transcode()

G4String G4GDMLRead::Transcode ( const XMLCh * const  toTranscode)
protected

Definition at line 55 of file G4GDMLRead.cc.

56{
57 char* char_str = xercesc::XMLString::transcode(toTranscode);
58 G4String my_str(char_str);
59 xercesc::XMLString::release(&char_str);
60 return my_str;
61}

Referenced by G4GDMLReadStructure::AssemblyRead(), G4GDMLReadMaterials::AtomRead(), AuxiliaryRead(), G4GDMLReadStructure::AxisRead(), G4GDMLReadSolids::BooleanRead(), G4GDMLReadStructure::BorderSurfaceRead(), G4GDMLReadParamvol::Box_dimensionsRead(), G4GDMLReadSolids::BoxRead(), G4GDMLReadMaterials::CompositeRead(), G4GDMLReadParamvol::Cone_dimensionsRead(), G4GDMLReadSolids::ConeRead(), G4GDMLReadDefine::ConstantRead(), G4GDMLReadSolids::CutTubeRead(), G4GDMLReadDefine::DefineRead(), G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadMaterials::DRead(), G4GDMLReadSolids::ElconeRead(), G4GDMLReadMaterials::ElementRead(), G4GDMLReadParamvol::Ellipsoid_dimensionsRead(), G4GDMLReadSolids::EllipsoidRead(), G4GDMLReadSolids::EltubeRead(), G4GDMLReadDefine::ExpressionRead(), G4GDMLReadStructure::FileRead(), G4GDMLReadMaterials::FractionRead(), G4GDMLReadSolids::GenericPolyconeRead(), G4GDMLReadSolids::GenericPolyhedraRead(), G4GDMLReadSolids::GenTrapRead(), G4GDMLReadParamvol::Hype_dimensionsRead(), G4GDMLReadSolids::HypeRead(), G4GDMLReadMaterials::IsotopeRead(), LoopRead(), G4GDMLReadMaterials::MaterialRead(), G4GDMLReadMaterials::MaterialsRead(), G4GDMLReadDefine::MatrixRead(), G4GDMLReadMaterials::MEERead(), G4GDMLReadMaterials::MixtureRead(), G4GDMLReadSolids::MultiUnionNodeRead(), G4GDMLReadSolids::MultiUnionRead(), G4GDMLReadSolids::OpticalSurfaceRead(), G4GDMLReadParamvol::Orb_dimensionsRead(), G4GDMLReadSolids::OrbRead(), G4GDMLReadParamvol::Para_dimensionsRead(), G4GDMLReadSolids::ParaboloidRead(), G4GDMLReadParamvol::ParameterisedRead(), G4GDMLReadParamvol::ParametersRead(), G4GDMLReadParamvol::Paramvol_contentRead(), G4GDMLReadParamvol::ParamvolRead(), G4GDMLReadSolids::ParaRead(), G4GDMLReadStructure::PhysvolRead(), G4GDMLReadParamvol::Polycone_dimensionsRead(), G4GDMLReadSolids::PolyconeRead(), G4GDMLReadParamvol::Polyhedra_dimensionsRead(), G4GDMLReadSolids::PolyhedraRead(), G4GDMLReadDefine::PositionRead(), G4GDMLReadMaterials::PRead(), G4GDMLReadMaterials::PropertyRead(), G4GDMLReadSolids::PropertyRead(), G4GDMLReadSolids::QuadrangularRead(), G4GDMLReadStructure::QuantityRead(), G4GDMLReadDefine::QuantityRead(), Read(), G4GDMLReadSolids::ReflectedSolidRead(), G4GDMLReadDefine::RefRead(), G4GDMLReadStructure::ReplicaRead(), G4GDMLReadStructure::ReplicavolRead(), G4GDMLReadDefine::RotationRead(), G4GDMLReadSolids::RZPointRead(), G4GDMLReadSolids::ScaledSolidRead(), G4GDMLReadDefine::ScaleRead(), G4GDMLReadSolids::SectionRead(), G4GDMLReadSetup::SetupRead(), G4GDMLReadStructure::SkinSurfaceRead(), G4GDMLReadSolids::SolidsRead(), G4GDMLReadParamvol::Sphere_dimensionsRead(), G4GDMLReadSolids::SphereRead(), G4GDMLReadStructure::StructureRead(), G4GDMLReadSolids::TessellatedRead(), G4GDMLReadSolids::TetRead(), G4GDMLReadParamvol::Torus_dimensionsRead(), G4GDMLReadSolids::TorusRead(), G4GDMLReadParamvol::Trap_dimensionsRead(), G4GDMLReadSolids::TrapRead(), G4GDMLReadParamvol::Trd_dimensionsRead(), G4GDMLReadSolids::TrdRead(), G4GDMLReadMaterials::TRead(), G4GDMLReadSolids::TriangularRead(), G4GDMLReadParamvol::Tube_dimensionsRead(), G4GDMLReadSolids::TubeRead(), G4GDMLReadSolids::TwistedboxRead(), G4GDMLReadSolids::TwistedtrapRead(), G4GDMLReadSolids::TwistedtrdRead(), G4GDMLReadSolids::TwistedtubsRead(), G4GDMLReadSolids::TwoDimVertexRead(), UserinfoRead(), G4GDMLReadDefine::VariableRead(), G4GDMLReadDefine::VectorRead(), G4GDMLReadStructure::Volume_contentRead(), G4GDMLReadStructure::VolumeRead(), G4GDMLReadSolids::XtruRead(), and G4GDMLReadSolids::ZplaneRead().

◆ UserinfoRead()

void G4GDMLRead::UserinfoRead ( const xercesc::DOMElement * const  userinfoElement)
virtual

Definition at line 377 of file G4GDMLRead.cc.

378{
379#ifdef G4VERBOSE
380 G4cout << "G4GDML: Reading userinfo..." << G4endl;
381#endif
382 for(xercesc::DOMNode* iter = userinfoElement->getFirstChild();
383 iter != nullptr; iter = iter->getNextSibling())
384 {
385 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
386 {
387 continue;
388 }
389
390 const xercesc::DOMElement* const child =
391 dynamic_cast<xercesc::DOMElement*>(iter);
392 if(!child)
393 {
394 G4Exception("G4GDMLRead::UserinfoRead()", "InvalidRead", FatalException,
395 "No child found!");
396 return;
397 }
398 const G4String tag = Transcode(child->getTagName());
399
400 if(tag == "auxiliary")
401 {
402 auxGlobalList.push_back(AuxiliaryRead(child));
403 }
404 else
405 {
406 G4String error_msg = "Unknown tag in structure: " + tag;
407 G4Exception("G4GDMLRead::UserinfoRead()", "ReadError", FatalException,
408 error_msg);
409 }
410 }
411}

References auxGlobalList, AuxiliaryRead(), FatalException, G4cout, G4endl, G4Exception(), and Transcode().

Referenced by Read().

◆ Volume_contentRead()

virtual void G4GDMLRead::Volume_contentRead ( const xercesc::DOMElement * const  )
pure virtual

Field Documentation

◆ auxGlobalList

G4GDMLAuxListType G4GDMLRead::auxGlobalList
private

Definition at line 164 of file G4GDMLRead.hh.

Referenced by GetAuxList(), and UserinfoRead().

◆ check

G4bool G4GDMLRead::check = false
protected

◆ dostrip

G4bool G4GDMLRead::dostrip = true
protected

Definition at line 159 of file G4GDMLRead.hh.

Referenced by G4GDMLReadStructure::GetWorldVolume(), and Read().

◆ eval

G4GDMLEvaluator G4GDMLRead::eval
protected

Definition at line 156 of file G4GDMLRead.hh.

Referenced by G4GDMLReadMaterials::AtomRead(), G4GDMLReadStructure::AxisRead(), G4GDMLReadParamvol::Box_dimensionsRead(), G4GDMLReadSolids::BoxRead(), G4GDMLReadStructure::Clear(), G4GDMLReadMaterials::CompositeRead(), G4GDMLReadParamvol::Cone_dimensionsRead(), G4GDMLReadSolids::ConeRead(), G4GDMLReadDefine::ConstantRead(), G4GDMLReadSolids::CutTubeRead(), G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadMaterials::DRead(), G4GDMLReadSolids::ElconeRead(), G4GDMLReadMaterials::ElementRead(), G4GDMLReadParamvol::Ellipsoid_dimensionsRead(), G4GDMLReadSolids::EllipsoidRead(), G4GDMLReadSolids::EltubeRead(), G4GDMLReadDefine::ExpressionRead(), G4GDMLReadMaterials::FractionRead(), GenerateName(), GeneratePhysvolName(), G4GDMLReadSolids::GenericPolyconeRead(), G4GDMLReadSolids::GenericPolyhedraRead(), G4GDMLReadSolids::GenTrapRead(), G4GDMLReadDefine::GetConstant(), G4GDMLReadDefine::GetVariable(), G4GDMLReadParamvol::Hype_dimensionsRead(), G4GDMLReadSolids::HypeRead(), G4GDMLReadMaterials::IsotopeRead(), G4GDMLReadDefine::IsValidID(), LoopRead(), G4GDMLReadMaterials::MaterialRead(), G4GDMLReadDefine::MatrixRead(), G4GDMLReadMaterials::MEERead(), G4GDMLReadSolids::OpticalSurfaceRead(), G4GDMLReadParamvol::Orb_dimensionsRead(), G4GDMLReadSolids::OrbRead(), G4GDMLReadParamvol::Para_dimensionsRead(), G4GDMLReadSolids::ParaboloidRead(), G4GDMLReadParamvol::ParameterisedRead(), G4GDMLReadSolids::ParaRead(), G4GDMLReadStructure::PhysvolRead(), G4GDMLReadParamvol::Polycone_dimensionsRead(), G4GDMLReadSolids::PolyconeRead(), G4GDMLReadParamvol::Polyhedra_dimensionsRead(), G4GDMLReadSolids::PolyhedraRead(), G4GDMLReadDefine::PositionRead(), G4GDMLReadMaterials::PRead(), G4GDMLReadStructure::QuantityRead(), G4GDMLReadDefine::QuantityRead(), G4GDMLReadSolids::ReflectedSolidRead(), G4GDMLReadDefine::RotationRead(), G4GDMLReadSolids::RZPointRead(), G4GDMLReadDefine::ScaleRead(), G4GDMLReadSolids::SectionRead(), G4GDMLReadParamvol::Sphere_dimensionsRead(), G4GDMLReadSolids::SphereRead(), G4GDMLReadParamvol::Torus_dimensionsRead(), G4GDMLReadSolids::TorusRead(), G4GDMLReadParamvol::Trap_dimensionsRead(), G4GDMLReadSolids::TrapRead(), G4GDMLReadParamvol::Trd_dimensionsRead(), G4GDMLReadSolids::TrdRead(), G4GDMLReadMaterials::TRead(), G4GDMLReadParamvol::Tube_dimensionsRead(), G4GDMLReadSolids::TubeRead(), G4GDMLReadSolids::TwistedboxRead(), G4GDMLReadSolids::TwistedtrapRead(), G4GDMLReadSolids::TwistedtrdRead(), G4GDMLReadSolids::TwistedtubsRead(), G4GDMLReadSolids::TwoDimVertexRead(), G4GDMLReadDefine::VariableRead(), G4GDMLReadDefine::VectorRead(), G4GDMLReadStructure::Volume_contentRead(), and G4GDMLReadSolids::ZplaneRead().

◆ inLoop

G4int G4GDMLRead::inLoop = 0
private

Definition at line 163 of file G4GDMLRead.hh.

Referenced by GenerateName(), LoopRead(), and Read().

◆ loopCount

G4int G4GDMLRead::loopCount = 0
private

Definition at line 163 of file G4GDMLRead.hh.

Referenced by LoopRead().

◆ validate

G4bool G4GDMLRead::validate = true
protected

Definition at line 157 of file G4GDMLRead.hh.

Referenced by G4GDMLReadStructure::FileRead(), and Read().


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