59 const xercesc::DOMNamedNodeMap*
const attributes
60 = atomElement->getAttributes();
61 XMLSize_t attributeCount = attributes->getLength();
63 for (XMLSize_t attribute_index=0;
64 attribute_index<attributeCount; attribute_index++)
66 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
68 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
71 const xercesc::DOMAttr*
const attribute
72 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
75 G4Exception(
"G4GDMLReadMaterials::AtomRead()",
"InvalidRead",
82 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
94 const xercesc::DOMNamedNodeMap*
const attributes
95 = compositeElement->getAttributes();
96 XMLSize_t attributeCount = attributes->getLength();
98 for (XMLSize_t attribute_index=0;
99 attribute_index<attributeCount; attribute_index++)
101 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
103 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
106 const xercesc::DOMAttr*
const attribute
107 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
110 G4Exception(
"G4GDMLReadMaterials::CompositeRead()",
"InvalidRead",
118 if (attName==
"ref") { ref = attValue; }
129 const xercesc::DOMNamedNodeMap*
const attributes
130 = DElement->getAttributes();
131 XMLSize_t attributeCount = attributes->getLength();
133 for (XMLSize_t attribute_index=0;
134 attribute_index<attributeCount; attribute_index++)
136 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
138 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
141 const xercesc::DOMAttr*
const attribute
142 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
145 G4Exception(
"G4GDMLReadMaterials::DRead()",
"InvalidRead",
152 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
153 if (attName==
"unit") { unit =
eval.
Evaluate(attValue); }
164 const xercesc::DOMNamedNodeMap*
const attributes = PElement->getAttributes();
165 XMLSize_t attributeCount = attributes->getLength();
167 for (XMLSize_t attribute_index=0;
168 attribute_index<attributeCount; attribute_index++)
170 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
172 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
175 const xercesc::DOMAttr*
const attribute
176 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
179 G4Exception(
"G4GDMLReadMaterials::PRead()",
"InvalidRead",
186 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
187 if (attName==
"unit") { unit =
eval.
Evaluate(attValue); }
198 const xercesc::DOMNamedNodeMap*
const attributes = TElement->getAttributes();
199 XMLSize_t attributeCount = attributes->getLength();
201 for (XMLSize_t attribute_index=0;
202 attribute_index<attributeCount; attribute_index++)
204 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
206 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
209 const xercesc::DOMAttr*
const attribute
210 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
213 G4Exception(
"G4GDMLReadMaterials::TRead()",
"InvalidRead",
220 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
221 if (attName==
"unit") { unit =
eval.
Evaluate(attValue); }
232 const xercesc::DOMNamedNodeMap*
const attributes = PElement->getAttributes();
233 XMLSize_t attributeCount = attributes->getLength();
235 for (XMLSize_t attribute_index=0;
236 attribute_index<attributeCount; attribute_index++)
238 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
240 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
243 const xercesc::DOMAttr*
const attribute
244 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
247 G4Exception(
"G4GDMLReadMaterials::MEERead()",
"InvalidRead",
254 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
255 if (attName==
"unit") { unit =
eval.
Evaluate(attValue); }
269 const xercesc::DOMNamedNodeMap*
const attributes
270 = elementElement->getAttributes();
271 XMLSize_t attributeCount = attributes->getLength();
273 for (XMLSize_t attribute_index=0;
274 attribute_index<attributeCount; attribute_index++)
276 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
278 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
281 const xercesc::DOMAttr*
const attribute
282 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
285 G4Exception(
"G4GDMLReadMaterials::ElementRead()",
"InvalidRead",
292 if (attName==
"name") { name =
GenerateName(attValue); }
else
293 if (attName==
"formula") { formula = attValue; }
else
299 for (xercesc::DOMNode* iter = elementElement->getFirstChild();
300 iter != 0; iter = iter->getNextSibling())
302 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
304 const xercesc::DOMElement*
const child
305 =
dynamic_cast<xercesc::DOMElement*
>(iter);
308 G4Exception(
"G4GDMLReadMaterials::ElementRead()",
"InvalidRead",
314 if (tag==
"atom") { a =
AtomRead(child); }
else
315 if (tag==
"fraction") { nComponents++; }
334 const xercesc::DOMNamedNodeMap*
const attributes
335 = fractionElement->getAttributes();
336 XMLSize_t attributeCount = attributes->getLength();
338 for (XMLSize_t attribute_index=0;
339 attribute_index<attributeCount; attribute_index++)
341 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
343 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
346 const xercesc::DOMAttr*
const attribute
347 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
350 G4Exception(
"G4GDMLReadMaterials::FractionRead()",
"InvalidRead",
358 if (attName==
"ref") { ref = attValue; }
372 const xercesc::DOMNamedNodeMap*
const attributes
373 = isotopeElement->getAttributes();
374 XMLSize_t attributeCount = attributes->getLength();
376 for (XMLSize_t attribute_index=0;
377 attribute_index<attributeCount;attribute_index++)
379 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
381 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
384 const xercesc::DOMAttr*
const attribute
385 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
388 G4Exception(
"G4GDMLReadMaterials::IsotopeRead()",
"InvalidRead",
395 if (attName==
"name") { name =
GenerateName(attValue); }
else
400 for (xercesc::DOMNode* iter = isotopeElement->getFirstChild();
401 iter != 0; iter = iter->getNextSibling())
403 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
405 const xercesc::DOMElement*
const child
406 =
dynamic_cast<xercesc::DOMElement*
>(iter);
409 G4Exception(
"G4GDMLReadMaterials::IsotopeRead()",
"InvalidRead",
415 if (tag==
"atom") { a =
AtomRead(child); }
433 const xercesc::DOMNamedNodeMap*
const attributes
434 = materialElement->getAttributes();
435 XMLSize_t attributeCount = attributes->getLength();
437 for (XMLSize_t attribute_index=0;
438 attribute_index<attributeCount; attribute_index++)
440 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
442 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
445 const xercesc::DOMAttr*
const attribute
446 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
449 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
456 if (attName==
"name") { name =
GenerateName(attValue); }
else
458 if (attName==
"state")
460 if (attValue==
"solid") { state =
kStateSolid; }
else
462 if (attValue==
"gas") { state =
kStateGas; }
468 for (xercesc::DOMNode* iter = materialElement->getFirstChild();
469 iter != 0; iter = iter->getNextSibling())
471 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
473 const xercesc::DOMElement*
const child
474 =
dynamic_cast<xercesc::DOMElement*
>(iter);
477 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
483 if (tag==
"atom") { a =
AtomRead(child); }
else
488 if (tag==
"D") { D =
DRead(child); }
else
489 if (tag==
"P") { P =
PRead(child); }
else
490 if (tag==
"T") { T =
TRead(child); }
else
491 if (tag==
"MEE") { MEE =
MEERead(child); }
else
492 if (tag==
"fraction" || tag==
"composite") { nComponents++; }
511 for (xercesc::DOMNode* iter = materialElement->getFirstChild();
512 iter != 0; iter = iter->getNextSibling())
514 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
516 const xercesc::DOMElement*
const child
517 =
dynamic_cast<xercesc::DOMElement*
>(iter);
520 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
533 for (xercesc::DOMNode* iter = mixtureElement->getFirstChild();
534 iter != 0; iter = iter->getNextSibling())
536 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
538 const xercesc::DOMElement*
const child
539 =
dynamic_cast<xercesc::DOMElement*
>(iter);
542 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidRead",
561 for (xercesc::DOMNode* iter = mixtureElement->getFirstChild();
562 iter != 0; iter = iter->getNextSibling())
564 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
566 const xercesc::DOMElement*
const child
567 =
dynamic_cast<xercesc::DOMElement*
>(iter);
570 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidRead",
584 if (materialPtr != 0) { material->
AddMaterial(materialPtr,n); }
else
585 if (elementPtr != 0) { material->
AddElement(elementPtr,n); }
587 if ((materialPtr == 0) && (elementPtr == 0))
589 G4String error_msg =
"Referenced material/element '"
591 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidSetup",
595 else if (tag==
"composite")
614 const xercesc::DOMNamedNodeMap*
const attributes
615 = propertyElement->getAttributes();
616 XMLSize_t attributeCount = attributes->getLength();
618 for (XMLSize_t attribute_index=0;
619 attribute_index<attributeCount; attribute_index++)
621 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
623 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
626 const xercesc::DOMAttr*
const attribute
627 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
630 G4Exception(
"G4GDMLReadMaterials::PropertyRead()",
"InvalidRead",
637 if (attName==
"name") { name =
GenerateName(attValue); }
else
638 if (attName==
"ref") { matrix =
GetMatrix(ref=attValue); }
652 if (matrix.
GetRows() == 0) {
return; }
667 for (
size_t i=0; i<matrix.
GetRows(); i++)
680 for (xercesc::DOMNode* iter = materialsElement->getFirstChild();
681 iter != 0; iter = iter->getNextSibling())
683 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
685 const xercesc::DOMElement*
const child
686 =
dynamic_cast<xercesc::DOMElement*
>(iter);
689 G4Exception(
"G4GDMLReadMaterials::MaterialsRead()",
"InvalidRead",
695 if (tag==
"define") {
DefineRead(child); }
else
701 G4String error_msg =
"Unknown tag in materials: " + tag;
702 G4Exception(
"G4GDMLReadMaterials::MaterialsRead()",
"InvalidSetup",
718 if (verbose && !elementPtr)
720 G4String error_msg =
"Referenced element '" + ref +
"' was not found!";
721 G4Exception(
"G4GDMLReadMaterials::GetElement()",
"InvalidRead",
733 if (verbose && !isotopePtr)
735 G4String error_msg =
"Referenced isotope '" + ref +
"' was not found!";
736 G4Exception(
"G4GDMLReadMaterials::GetIsotope()",
"InvalidRead",
753 if (verbose && !materialPtr)
755 G4String error_msg =
"Referenced material '" + ref +
"' was not found!";
756 G4Exception(
"G4GDMLReadMaterials::GetMaterial()",
"InvalidRead",