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
85 G4Exception(
"G4GDMLReadMaterials::AtomRead()",
"InvalidRead",
98 const xercesc::DOMNamedNodeMap*
const attributes
99 = compositeElement->getAttributes();
100 XMLSize_t attributeCount = attributes->getLength();
102 for (XMLSize_t attribute_index=0;
103 attribute_index<attributeCount; attribute_index++)
105 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
107 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
110 const xercesc::DOMAttr*
const attribute
111 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
114 G4Exception(
"G4GDMLReadMaterials::CompositeRead()",
"InvalidRead",
122 if (attName==
"ref") { ref = attValue; }
133 const xercesc::DOMNamedNodeMap*
const attributes
134 = DElement->getAttributes();
135 XMLSize_t attributeCount = attributes->getLength();
137 for (XMLSize_t attribute_index=0;
138 attribute_index<attributeCount; attribute_index++)
140 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
142 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
145 const xercesc::DOMAttr*
const attribute
146 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
149 G4Exception(
"G4GDMLReadMaterials::DRead()",
"InvalidRead",
156 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
157 if (attName==
"unit") {
160 G4Exception(
"G4GDMLReadMaterials::DRead()",
"InvalidRead",
173 const xercesc::DOMNamedNodeMap*
const attributes = PElement->getAttributes();
174 XMLSize_t attributeCount = attributes->getLength();
176 for (XMLSize_t attribute_index=0;
177 attribute_index<attributeCount; attribute_index++)
179 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
181 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
184 const xercesc::DOMAttr*
const attribute
185 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
188 G4Exception(
"G4GDMLReadMaterials::PRead()",
"InvalidRead",
195 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
198 G4Exception(
"G4GDMLReadMaterials::PRead()",
"InvalidRead",
211 const xercesc::DOMNamedNodeMap*
const attributes = TElement->getAttributes();
212 XMLSize_t attributeCount = attributes->getLength();
214 for (XMLSize_t attribute_index=0;
215 attribute_index<attributeCount; attribute_index++)
217 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
219 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
222 const xercesc::DOMAttr*
const attribute
223 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
226 G4Exception(
"G4GDMLReadMaterials::TRead()",
"InvalidRead",
233 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
236 G4Exception(
"G4GDMLReadMaterials::TRead()",
"InvalidRead",
249 const xercesc::DOMNamedNodeMap*
const attributes = PElement->getAttributes();
250 XMLSize_t attributeCount = attributes->getLength();
252 for (XMLSize_t attribute_index=0;
253 attribute_index<attributeCount; attribute_index++)
255 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
257 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
260 const xercesc::DOMAttr*
const attribute
261 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
264 G4Exception(
"G4GDMLReadMaterials::MEERead()",
"InvalidRead",
271 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
274 G4Exception(
"G4GDMLReadMaterials::MEERead()",
"InvalidRead",
290 const xercesc::DOMNamedNodeMap*
const attributes
291 = elementElement->getAttributes();
292 XMLSize_t attributeCount = attributes->getLength();
294 for (XMLSize_t attribute_index=0;
295 attribute_index<attributeCount; attribute_index++)
297 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
299 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
302 const xercesc::DOMAttr*
const attribute
303 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
306 G4Exception(
"G4GDMLReadMaterials::ElementRead()",
"InvalidRead",
313 if (attName==
"name") { name =
GenerateName(attValue); }
else
314 if (attName==
"formula") { formula = attValue; }
else
318 G4int nComponents = 0;
320 for (xercesc::DOMNode* iter = elementElement->getFirstChild();
321 iter != 0; iter = iter->getNextSibling())
323 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
325 const xercesc::DOMElement*
const child
326 =
dynamic_cast<xercesc::DOMElement*
>(iter);
329 G4Exception(
"G4GDMLReadMaterials::ElementRead()",
"InvalidRead",
335 if (tag==
"atom") { a =
AtomRead(child); }
else
336 if (tag==
"fraction") { nComponents++; }
355 const xercesc::DOMNamedNodeMap*
const attributes
356 = fractionElement->getAttributes();
357 XMLSize_t attributeCount = attributes->getLength();
359 for (XMLSize_t attribute_index=0;
360 attribute_index<attributeCount; attribute_index++)
362 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
364 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
367 const xercesc::DOMAttr*
const attribute
368 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
371 G4Exception(
"G4GDMLReadMaterials::FractionRead()",
"InvalidRead",
379 if (attName==
"ref") { ref = attValue; }
393 const xercesc::DOMNamedNodeMap*
const attributes
394 = isotopeElement->getAttributes();
395 XMLSize_t attributeCount = attributes->getLength();
397 for (XMLSize_t attribute_index=0;
398 attribute_index<attributeCount;attribute_index++)
400 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
402 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
405 const xercesc::DOMAttr*
const attribute
406 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
409 G4Exception(
"G4GDMLReadMaterials::IsotopeRead()",
"InvalidRead",
416 if (attName==
"name") { name =
GenerateName(attValue); }
else
421 for (xercesc::DOMNode* iter = isotopeElement->getFirstChild();
422 iter != 0; iter = iter->getNextSibling())
424 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
426 const xercesc::DOMElement*
const child
427 =
dynamic_cast<xercesc::DOMElement*
>(iter);
430 G4Exception(
"G4GDMLReadMaterials::IsotopeRead()",
"InvalidRead",
436 if (tag==
"atom") { a =
AtomRead(child); }
454 const xercesc::DOMNamedNodeMap*
const attributes
455 = materialElement->getAttributes();
456 XMLSize_t attributeCount = attributes->getLength();
458 for (XMLSize_t attribute_index=0;
459 attribute_index<attributeCount; attribute_index++)
461 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
463 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
466 const xercesc::DOMAttr*
const attribute
467 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
470 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
477 if (attName==
"name") { name =
GenerateName(attValue); }
else
479 if (attName==
"state")
481 if (attValue==
"solid") { state =
kStateSolid; }
else
483 if (attValue==
"gas") { state =
kStateGas; }
487 size_t nComponents = 0;
489 for (xercesc::DOMNode* iter = materialElement->getFirstChild();
490 iter != 0; iter = iter->getNextSibling())
492 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
494 const xercesc::DOMElement*
const child
495 =
dynamic_cast<xercesc::DOMElement*
>(iter);
498 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
504 if (tag==
"atom") { a =
AtomRead(child); }
else
509 if (tag==
"D") { D =
DRead(child); }
else
510 if (tag==
"P") { P =
PRead(child); }
else
511 if (tag==
"T") { T =
TRead(child); }
else
512 if (tag==
"MEE") { MEE =
MEERead(child); }
else
513 if (tag==
"fraction" || tag==
"composite") { nComponents++; }
532 for (xercesc::DOMNode* iter = materialElement->getFirstChild();
533 iter != 0; iter = iter->getNextSibling())
535 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
537 const xercesc::DOMElement*
const child
538 =
dynamic_cast<xercesc::DOMElement*
>(iter);
541 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
554 for (xercesc::DOMNode* iter = mixtureElement->getFirstChild();
555 iter != 0; iter = iter->getNextSibling())
557 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
559 const xercesc::DOMElement*
const child
560 =
dynamic_cast<xercesc::DOMElement*
>(iter);
563 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidRead",
582 for (xercesc::DOMNode* iter = mixtureElement->getFirstChild();
583 iter != 0; iter = iter->getNextSibling())
585 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
587 const xercesc::DOMElement*
const child
588 =
dynamic_cast<xercesc::DOMElement*
>(iter);
591 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidRead",
605 if (elementPtr != 0) { material->
AddElement(elementPtr,n); }
else
606 if (materialPtr != 0) { material->
AddMaterial(materialPtr,n); }
608 if ((materialPtr == 0) && (elementPtr == 0))
610 G4String error_msg =
"Referenced material/element '"
612 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidSetup",
616 else if (tag==
"composite")
635 const xercesc::DOMNamedNodeMap*
const attributes
636 = propertyElement->getAttributes();
637 XMLSize_t attributeCount = attributes->getLength();
639 for (XMLSize_t attribute_index=0;
640 attribute_index<attributeCount; attribute_index++)
642 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
644 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
647 const xercesc::DOMAttr*
const attribute
648 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
651 G4Exception(
"G4GDMLReadMaterials::PropertyRead()",
"InvalidRead",
658 if (attName==
"name") { name =
GenerateName(attValue); }
else
659 if (attName==
"ref") { matrix =
GetMatrix(ref=attValue); }
673 if (matrix.
GetRows() == 0) {
return; }
688 for (
size_t i=0; i<matrix.
GetRows(); i++)
702 for (xercesc::DOMNode* iter = materialsElement->getFirstChild();
703 iter != 0; iter = iter->getNextSibling())
705 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
707 const xercesc::DOMElement*
const child
708 =
dynamic_cast<xercesc::DOMElement*
>(iter);
711 G4Exception(
"G4GDMLReadMaterials::MaterialsRead()",
"InvalidRead",
717 if (tag==
"define") {
DefineRead(child); }
else
723 G4String error_msg =
"Unknown tag in materials: " + tag;
724 G4Exception(
"G4GDMLReadMaterials::MaterialsRead()",
"InvalidSetup",
740 if (verbose && !elementPtr)
742 G4String error_msg =
"Referenced element '" + ref +
"' was not found!";
743 G4Exception(
"G4GDMLReadMaterials::GetElement()",
"InvalidRead",
755 if (verbose && !isotopePtr)
757 G4String error_msg =
"Referenced isotope '" + ref +
"' was not found!";
758 G4Exception(
"G4GDMLReadMaterials::GetIsotope()",
"InvalidRead",
775 if (verbose && !materialPtr)
777 G4String error_msg =
"Referenced material '" + ref +
"' was not found!";
778 G4Exception(
"G4GDMLReadMaterials::GetMaterial()",
"InvalidRead",