56 xercesc::DOMElement* atomElement =
NewElement(
"atom");
57 atomElement->setAttributeNode(
NewAttribute(
"unit",
"g/mole"));
58 atomElement->setAttributeNode(
NewAttribute(
"value", a * mole / g));
59 element->appendChild(atomElement);
66 xercesc::DOMElement* DElement =
NewElement(
"D");
67 DElement->setAttributeNode(
NewAttribute(
"unit",
"g/cm3"));
68 DElement->setAttributeNode(
NewAttribute(
"value", d * cm3 / g));
69 element->appendChild(DElement);
76 xercesc::DOMElement* PElement =
NewElement(
"P");
77 PElement->setAttributeNode(
NewAttribute(
"unit",
"pascal"));
78 PElement->setAttributeNode(
NewAttribute(
"value", P / hep_pascal));
79 element->appendChild(PElement);
86 xercesc::DOMElement* TElement =
NewElement(
"T");
88 TElement->setAttributeNode(
NewAttribute(
"value", T / kelvin));
89 element->appendChild(TElement);
96 xercesc::DOMElement* PElement =
NewElement(
"MEE");
98 PElement->setAttributeNode(
NewAttribute(
"value", MEE / electronvolt));
99 element->appendChild(PElement);
107 xercesc::DOMElement* isotopeElement =
NewElement(
"isotope");
108 isotopeElement->setAttributeNode(
NewAttribute(
"name", name));
120 xercesc::DOMElement* elementElement =
NewElement(
"element");
121 elementElement->setAttributeNode(
NewAttribute(
"name", name));
125 if(NumberOfIsotopes > 0)
127 const G4double* RelativeAbundanceVector
129 for(std::size_t i = 0; i < NumberOfIsotopes; ++i)
133 xercesc::DOMElement* fractionElement =
NewElement(
"fraction");
134 fractionElement->setAttributeNode(
136 fractionElement->setAttributeNode(
NewAttribute(
"ref", fractionref));
137 elementElement->appendChild(fractionElement);
162 state_str =
"liquid";
171 xercesc::DOMElement* materialElement =
NewElement(
"material");
172 materialElement->setAttributeNode(
NewAttribute(
"name", name));
173 materialElement->setAttributeNode(
NewAttribute(
"state", state_str));
200 if((NumberOfElements > 1) ||
206 for(std::size_t i = 0; i < NumberOfElements; ++i)
210 xercesc::DOMElement* fractionElement =
NewElement(
"fraction");
211 fractionElement->setAttributeNode(
213 fractionElement->setAttributeNode(
NewAttribute(
"ref", fractionref));
214 materialElement->appendChild(fractionElement);
243 xercesc::DOMElement* matrixElement =
NewElement(
"matrix");
244 matrixElement->setAttributeNode(
NewAttribute(
"name", matrixref));
245 matrixElement->setAttributeNode(
NewAttribute(
"coldim",
"2"));
246 std::ostringstream pvalues;
253 pvalues << pvec->
Energy(i) <<
" " << (*pvec)[i];
255 matrixElement->setAttributeNode(
NewAttribute(
"values", pvalues.str()));
266 xercesc::DOMElement* matrixElement =
NewElement(
"matrix");
267 matrixElement->setAttributeNode(
NewAttribute(
"name", matrixref));
268 matrixElement->setAttributeNode(
NewAttribute(
"coldim",
"1"));
269 std::ostringstream pvalues;
272 matrixElement->setAttributeNode(
NewAttribute(
"values", pvalues.str()));
281 xercesc::DOMElement* propElement;
287 for(
auto mpos = pmap->cbegin(); mpos != pmap->cend(); ++mpos)
290 propElement->setAttributeNode(
299 matElement->appendChild(propElement);
303 G4String warn_message =
"Null pointer for material property -" +
305 "- of material -" + mat->
GetName() +
"- !";
306 G4Exception(
"G4GDMLWriteMaterials::PropertyWrite()",
"NullPointer",
312 for(
auto cpos = cmap->cbegin(); cpos != cmap->cend(); ++cpos)
322 cpos->second, ptable);
324 matElement->appendChild(propElement);
346 for(std::size_t i = 0; i <
isotopeList.size(); ++i)
360 for(std::size_t i = 0; i <
elementList.size(); ++i)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() const
const G4String & GetName() const
xercesc::DOMElement * defineElement
std::vector< const G4PhysicsOrderedFreeVector * > propertyList
void TWrite(xercesc::DOMElement *, const G4double &)
void MEEWrite(xercesc::DOMElement *, const G4double &)
void MaterialWrite(const G4Material *const)
void DWrite(xercesc::DOMElement *, const G4double &)
void AtomWrite(xercesc::DOMElement *, const G4double &)
virtual void MaterialsWrite(xercesc::DOMElement *)
void AddIsotope(const G4Isotope *const)
void PropertyVectorWrite(const G4String &, const G4PhysicsOrderedFreeVector *const)
void AddMaterial(const G4Material *const)
std::vector< const G4Element * > elementList
xercesc::DOMElement * materialsElement
std::vector< const G4Material * > materialList
void PWrite(xercesc::DOMElement *, const G4double &)
void ElementWrite(const G4Element *const)
void AddElement(const G4Element *const)
void PropertyConstWrite(const G4String &, const G4double, const G4MaterialPropertiesTable *)
void PropertyWrite(xercesc::DOMElement *, const G4Material *const)
void IsotopeWrite(const G4Isotope *const)
virtual ~G4GDMLWriteMaterials()
std::vector< const G4Isotope * > isotopeList
xercesc::DOMElement * NewElement(const G4String &)
G4String GenerateName(const G4String &, const void *const)
xercesc::DOMAttr * NewAttribute(const G4String &, const G4String &)
G4double GetMeanExcitationEnergy() const
const G4String & GetName() const
std::vector< G4String > GetMaterialPropertyNames() const
std::vector< G4String > GetMaterialConstPropertyNames() const
const std::map< G4int, G4double, std::less< G4int > > * GetConstPropertyMap() const
const std::map< G4int, G4MaterialPropertyVector *, std::less< G4int > > * GetPropertyMap() const
G4double GetPressure() const
G4double GetDensity() const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
G4double GetTemperature() const
const G4Element * GetElement(G4int iel) const
const G4double * GetFractionVector() const
G4IonisParamMat * GetIonisation() const
size_t GetNumberOfElements() const
const G4String & GetName() const
G4double Energy(std::size_t index) const
std::size_t GetVectorLength() const