Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/persistency/gdml/src/G4GDMLWriteMaterials.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /persistency/gdml/src/G4GDMLWriteMaterials.cc (Version 11.3.0) and /persistency/gdml/src/G4GDMLWriteMaterials.cc (Version 9.4.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4GDMLWriteMaterials implementation         << 
 27 //                                                 26 //
 28 // Author: Zoltan Torzsok, November 2007       <<  27 // $Id: G4GDMLWriteMaterials.cc,v 1.26 2010-10-14 16:19:40 gcosmo Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-04-patch-01 $
                                                   >>  29 //
                                                   >>  30 // class G4GDMLWriteMaterials Implementation
                                                   >>  31 //
                                                   >>  32 // Original author: Zoltan Torzsok, November 2007
                                                   >>  33 //
 29 // -------------------------------------------     34 // --------------------------------------------------------------------
 30                                                    35 
 31 #include <sstream>                                 36 #include <sstream>
 32                                                << 
 33 #include "G4GDMLWriteMaterials.hh"                 37 #include "G4GDMLWriteMaterials.hh"
 34                                                    38 
 35 #include "G4PhysicalConstants.hh"              << 
 36 #include "G4SystemOfUnits.hh"                  << 
 37 #include "G4Element.hh"                            39 #include "G4Element.hh"
 38 #include "G4Isotope.hh"                            40 #include "G4Isotope.hh"
 39 #include "G4Material.hh"                           41 #include "G4Material.hh"
 40                                                    42 
 41 // ------------------------------------------- << 
 42 G4GDMLWriteMaterials::G4GDMLWriteMaterials()       43 G4GDMLWriteMaterials::G4GDMLWriteMaterials()
 43   : G4GDMLWriteDefine()                        <<  44   : G4GDMLWriteDefine(), materialsElement(0)
 44 {                                                  45 {
 45 }                                                  46 }
 46                                                    47 
 47 // ------------------------------------------- << 
 48 G4GDMLWriteMaterials::~G4GDMLWriteMaterials()      48 G4GDMLWriteMaterials::~G4GDMLWriteMaterials()
 49 {                                                  49 {
 50 }                                                  50 }
 51                                                    51 
 52 // ------------------------------------------- <<  52 void G4GDMLWriteMaterials::
 53 void G4GDMLWriteMaterials::AtomWrite(xercesc:: <<  53 AtomWrite(xercesc::DOMElement* element,const G4double& a)
 54                                      const G4d << 
 55 {                                              << 
 56   xercesc::DOMElement* atomElement = NewElemen << 
 57   atomElement->setAttributeNode(NewAttribute(" << 
 58   atomElement->setAttributeNode(NewAttribute(" << 
 59   element->appendChild(atomElement);           << 
 60 }                                              << 
 61                                                << 
 62 // ------------------------------------------- << 
 63 void G4GDMLWriteMaterials::DWrite(xercesc::DOM << 
 64                                   const G4doub << 
 65 {                                                  54 {
 66   xercesc::DOMElement* DElement = NewElement(" <<  55    xercesc::DOMElement* atomElement = NewElement("atom");
 67   DElement->setAttributeNode(NewAttribute("uni <<  56    atomElement->setAttributeNode(NewAttribute("unit","g/mole"));
 68   DElement->setAttributeNode(NewAttribute("val <<  57    atomElement->setAttributeNode(NewAttribute("value",a*mole/g));
 69   element->appendChild(DElement);              <<  58    element->appendChild(atomElement);
 70 }                                                  59 }
 71                                                    60 
 72 // ------------------------------------------- <<  61 void G4GDMLWriteMaterials::
 73 void G4GDMLWriteMaterials::PWrite(xercesc::DOM <<  62 DWrite(xercesc::DOMElement* element,const G4double& d)
 74                                   const G4doub << 
 75 {                                                  63 {
 76   xercesc::DOMElement* PElement = NewElement(" <<  64    xercesc::DOMElement* DElement = NewElement("D");
 77   PElement->setAttributeNode(NewAttribute("uni <<  65    DElement->setAttributeNode(NewAttribute("unit","g/cm3"));
 78   PElement->setAttributeNode(NewAttribute("val <<  66    DElement->setAttributeNode(NewAttribute("value",d*cm3/g));
 79   element->appendChild(PElement);              <<  67    element->appendChild(DElement);
 80 }                                                  68 }
 81                                                    69 
 82 // ------------------------------------------- <<  70 void G4GDMLWriteMaterials::
 83 void G4GDMLWriteMaterials::TWrite(xercesc::DOM <<  71 PWrite(xercesc::DOMElement* element,const G4double& P)
 84                                   const G4doub << 
 85 {                                                  72 {
 86   xercesc::DOMElement* TElement = NewElement(" <<  73    xercesc::DOMElement* PElement = NewElement("P");
 87   TElement->setAttributeNode(NewAttribute("uni <<  74    PElement->setAttributeNode(NewAttribute("unit","pascal"));
 88   TElement->setAttributeNode(NewAttribute("val <<  75    PElement->setAttributeNode(NewAttribute("value",P/pascal));
 89   element->appendChild(TElement);              <<  76    element->appendChild(PElement);
 90 }                                                  77 }
 91                                                    78 
 92 // ------------------------------------------- <<  79 void G4GDMLWriteMaterials::
 93 void G4GDMLWriteMaterials::MEEWrite(xercesc::D <<  80 TWrite(xercesc::DOMElement* element,const G4double& T)
 94                                     const G4do << 
 95 {                                                  81 {
 96   xercesc::DOMElement* PElement = NewElement(" <<  82    xercesc::DOMElement* TElement = NewElement("T");
 97   PElement->setAttributeNode(NewAttribute("uni <<  83    TElement->setAttributeNode(NewAttribute("unit","K"));
 98   PElement->setAttributeNode(NewAttribute("val <<  84    TElement->setAttributeNode(NewAttribute("value",T/kelvin));
 99   element->appendChild(PElement);              <<  85    element->appendChild(TElement);
100 }                                                  86 }
101                                                    87 
102 // ------------------------------------------- <<  88 void G4GDMLWriteMaterials::
103 void G4GDMLWriteMaterials::IsotopeWrite(const  <<  89 IsotopeWrite(const G4Isotope* const isotopePtr)
104 {                                                  90 {
105   const G4String name = GenerateName(isotopePt <<  91    const G4String name = GenerateName(isotopePtr->GetName(),isotopePtr);
106                                                    92 
107   xercesc::DOMElement* isotopeElement = NewEle <<  93    xercesc::DOMElement* isotopeElement = NewElement("isotope");
108   isotopeElement->setAttributeNode(NewAttribut <<  94    isotopeElement->setAttributeNode(NewAttribute("name",name));
109   isotopeElement->setAttributeNode(NewAttribut <<  95    isotopeElement->setAttributeNode(NewAttribute("N",isotopePtr->GetN()));
110   isotopeElement->setAttributeNode(NewAttribut <<  96    isotopeElement->setAttributeNode(NewAttribute("Z",isotopePtr->GetZ()));
111   materialsElement->appendChild(isotopeElement <<  97    materialsElement->appendChild(isotopeElement);
112   AtomWrite(isotopeElement, isotopePtr->GetA() <<  98    AtomWrite(isotopeElement,isotopePtr->GetA());
113 }                                                  99 }
114                                                   100 
115 // ------------------------------------------- << 
116 void G4GDMLWriteMaterials::ElementWrite(const     101 void G4GDMLWriteMaterials::ElementWrite(const G4Element* const elementPtr)
117 {                                                 102 {
118   const G4String name = GenerateName(elementPt << 103    const G4String name = GenerateName(elementPtr->GetName(),elementPtr);
119                                                   104 
120   xercesc::DOMElement* elementElement = NewEle << 105    xercesc::DOMElement* elementElement = NewElement("element");
121   elementElement->setAttributeNode(NewAttribut << 106    elementElement->setAttributeNode(NewAttribute("name",name));
122                                                   107 
123   const G4int NumberOfIsotopes = (G4int)elemen << 108    const size_t NumberOfIsotopes = elementPtr->GetNumberOfIsotopes();
124                                                   109 
125   if(NumberOfIsotopes > 0)                     << 110    if (NumberOfIsotopes>0)
126   {                                            << 111    {
127     const G4double* RelativeAbundanceVector    << 112       const G4double* RelativeAbundanceVector =
128       = elementPtr->GetRelativeAbundanceVector << 113             elementPtr->GetRelativeAbundanceVector();             
129     for(G4int i = 0; i < NumberOfIsotopes; ++i << 114       for (size_t i=0;i<NumberOfIsotopes;i++)
130     {                                          << 115       {
131       G4String fractionref = GenerateName(elem << 116          G4String fractionref = GenerateName(elementPtr->GetIsotope(i)->GetName(),
132                                           elem << 117                                              elementPtr->GetIsotope(i));
133       xercesc::DOMElement* fractionElement = N << 118          xercesc::DOMElement* fractionElement = NewElement("fraction");
134       fractionElement->setAttributeNode(       << 119          fractionElement->setAttributeNode(NewAttribute("n",
135         NewAttribute("n", RelativeAbundanceVec << 120                                            RelativeAbundanceVector[i]));
136       fractionElement->setAttributeNode(NewAtt << 121          fractionElement->setAttributeNode(NewAttribute("ref",fractionref));
137       elementElement->appendChild(fractionElem << 122          elementElement->appendChild(fractionElement);
138       AddIsotope(elementPtr->GetIsotope(i));   << 123          AddIsotope(elementPtr->GetIsotope(i));
139     }                                          << 124       }
140   }                                            << 125    }
141   else                                         << 126    else
142   {                                            << 127    {
143     elementElement->setAttributeNode(NewAttrib << 128       elementElement->setAttributeNode(NewAttribute("Z",elementPtr->GetZ()));
144     AtomWrite(elementElement, elementPtr->GetA << 129       AtomWrite(elementElement,elementPtr->GetA());
145   }                                            << 130    }
146                                                   131 
147   materialsElement->appendChild(elementElement << 132    materialsElement->appendChild(elementElement);
148   // Append the element AFTER all the possible << 133      // Append the element AFTER all the possible components are appended!
149 }                                                 134 }
150                                                   135 
151 // ------------------------------------------- << 
152 void G4GDMLWriteMaterials::MaterialWrite(const    136 void G4GDMLWriteMaterials::MaterialWrite(const G4Material* const materialPtr)
153 {                                                 137 {
154   G4String state_str("undefined");             << 138    G4String state_str("undefined");
155   const G4State state = materialPtr->GetState( << 139    const G4State state = materialPtr->GetState();
156   if(state == kStateSolid)                     << 140    if (state==kStateSolid) { state_str = "solid"; } else
157   {                                            << 141    if (state==kStateLiquid) { state_str = "liquid"; } else
158     state_str = "solid";                       << 142    if (state==kStateGas) { state_str = "gas"; }
159   }                                            << 143 
160   else if(state == kStateLiquid)               << 144    const G4String name = GenerateName(materialPtr->GetName(), materialPtr);
161   {                                            << 145 
162     state_str = "liquid";                      << 146    xercesc::DOMElement* materialElement = NewElement("material");
163   }                                            << 147    materialElement->setAttributeNode(NewAttribute("name",name));
164   else if(state == kStateGas)                  << 148    materialElement->setAttributeNode(NewAttribute("state",state_str));
165   {                                            << 149 
166     state_str = "gas";                         << 150    // Write any property attached to the material...
167   }                                            << 151    //
168                                                << 152    if (materialPtr->GetMaterialPropertiesTable())
169   const G4String name = GenerateName(materialP << 153    {
170                                                << 154      PropertyWrite(materialElement, materialPtr);
171   xercesc::DOMElement* materialElement = NewEl << 155    }
172   materialElement->setAttributeNode(NewAttribu << 156 
173   materialElement->setAttributeNode(NewAttribu << 157    if (materialPtr->GetTemperature() != STP_Temperature)
174                                                << 158      { TWrite(materialElement,materialPtr->GetTemperature()); }
175   // Write any property attached to the materi << 159    if (materialPtr->GetPressure() != STP_Pressure)
176   //                                           << 160      { PWrite(materialElement,materialPtr->GetPressure()); }
177   if(materialPtr->GetMaterialPropertiesTable() << 161    DWrite(materialElement,materialPtr->GetDensity());
178   {                                            << 162   
179     PropertyWrite(materialElement, materialPtr << 163    const size_t NumberOfElements = materialPtr->GetNumberOfElements();
180   }                                            << 164 
181                                                << 165    if ( (NumberOfElements>1)
182   if(materialPtr->GetTemperature() != STP_Temp << 166       || ( materialPtr->GetElement(0)
183   {                                            << 167         && materialPtr->GetElement(0)->GetNumberOfIsotopes()>1 ) )
184     TWrite(materialElement, materialPtr->GetTe << 168    {
185   }                                            << 169       const G4double* MassFractionVector = materialPtr->GetFractionVector();
186                                                << 170 
187   if(materialPtr->GetPressure() != STP_Pressur << 171       for (size_t i=0;i<NumberOfElements;i++)
188   {                                            << 172       {
189     PWrite(materialElement, materialPtr->GetPr << 173          const G4String fractionref =
190   }                                            << 174                         GenerateName(materialPtr->GetElement(i)->GetName(),
191                                                << 175                                      materialPtr->GetElement(i));
192   // Write Ionisation potential (mean excitati << 176          xercesc::DOMElement* fractionElement = NewElement("fraction");
193   MEEWrite(materialElement,                    << 177          fractionElement->setAttributeNode(NewAttribute("n",
194            materialPtr->GetIonisation()->GetMe << 178                                            MassFractionVector[i]));
195                                                << 179          fractionElement->setAttributeNode(NewAttribute("ref",fractionref));
196   DWrite(materialElement, materialPtr->GetDens << 180          materialElement->appendChild(fractionElement);
197                                                << 181          AddElement(materialPtr->GetElement(i));
198   const G4int NumberOfElements = (G4int)materi << 182       }
199                                                << 183    }
200   if((NumberOfElements > 1) ||                 << 184    else
201      (materialPtr->GetElement(0) != nullptr && << 185    {
202       materialPtr->GetElement(0)->GetNumberOfI << 186       materialElement->setAttributeNode(NewAttribute("Z",materialPtr->GetZ()));
203   {                                            << 187       AtomWrite(materialElement,materialPtr->GetA());
204     const G4double* MassFractionVector = mater << 188    }
205                                                << 189 
206     for(G4int i = 0; i < NumberOfElements; ++i << 190    // Append the material AFTER all the possible components are appended!
207     {                                          << 191    //
208       const G4String fractionref = GenerateNam << 192    materialsElement->appendChild(materialElement);
209         materialPtr->GetElement(i)->GetName(), << 193 }
210       xercesc::DOMElement* fractionElement = N << 194 
211       fractionElement->setAttributeNode(       << 195 void G4GDMLWriteMaterials::PropertyVectorWrite(const G4String& key,
212         NewAttribute("n", MassFractionVector[i << 196                            const G4MaterialPropertyVector* const pvec)
213       fractionElement->setAttributeNode(NewAtt << 197 {
214       materialElement->appendChild(fractionEle << 198    const G4String matrixref = GenerateName(key, pvec);
215       AddElement(materialPtr->GetElement(i));  << 199    xercesc::DOMElement* matrixElement = NewElement("matrix");
216     }                                          << 200    matrixElement->setAttributeNode(NewAttribute("name", matrixref));
217   }                                            << 201    matrixElement->setAttributeNode(NewAttribute("coldim", "2"));
218   else                                         << 202    std::ostringstream pvalues;
219   {                                            << 203    for (G4int i=0; i<pvec->Entries(); i++)
220     materialElement->setAttributeNode(NewAttri << 204    {
221     AtomWrite(materialElement, materialPtr->Ge << 205      G4MPVEntry cval = pvec->GetEntry(i);
222   }                                            << 206      if (i!=0)  { pvalues << " "; }
223                                                << 207      pvalues << cval.GetPhotonEnergy() << " " << cval.GetProperty();
224   // Append the material AFTER all the possibl << 208    }
225   //                                           << 209    matrixElement->setAttributeNode(NewAttribute("values", pvalues.str()));
226   materialsElement->appendChild(materialElemen << 
227 }                                              << 
228                                                << 
229 // ------------------------------------------- << 
230 void G4GDMLWriteMaterials::PropertyVectorWrite << 
231   const G4String& key, const G4PhysicsFreeVect << 
232 {                                              << 
233   for(std::size_t i = 0; i < propertyList.size << 
234   {                                            << 
235     if(propertyList[i] == pvec)                << 
236     {                                          << 
237       return;                                  << 
238     }                                          << 
239   }                                            << 
240   propertyList.push_back(pvec);                << 
241                                                << 
242   const G4String matrixref = GenerateName(key, << 
243   xercesc::DOMElement* matrixElement = NewElem << 
244   matrixElement->setAttributeNode(NewAttribute << 
245   matrixElement->setAttributeNode(NewAttribute << 
246   std::ostringstream pvalues;                  << 
247   for(std::size_t i = 0; i < pvec->GetVectorLe << 
248   {                                            << 
249     if(i != 0)                                 << 
250     {                                          << 
251       pvalues << " ";                          << 
252     }                                          << 
253     pvalues << pvec->Energy(i) << " " << (*pve << 
254   }                                            << 
255   matrixElement->setAttributeNode(NewAttribute << 
256                                                   210 
257   defineElement->appendChild(matrixElement);   << 211    defineElement->appendChild(matrixElement);
258 }                                                 212 }
259                                                   213 
260 // ------------------------------------------- << 
261 void G4GDMLWriteMaterials::PropertyConstWrite( << 
262   const G4String& key, const G4double pval,    << 
263   const G4MaterialPropertiesTable* ptable)     << 
264 {                                              << 
265   const G4String matrixref           = Generat << 
266   xercesc::DOMElement* matrixElement = NewElem << 
267   matrixElement->setAttributeNode(NewAttribute << 
268   matrixElement->setAttributeNode(NewAttribute << 
269   std::ostringstream pvalues;                  << 
270                                                << 
271   pvalues << pval;                             << 
272   matrixElement->setAttributeNode(NewAttribute << 
273                                                << 
274   defineElement->appendChild(matrixElement);   << 
275 }                                              << 
276                                                << 
277 // ------------------------------------------- << 
278 void G4GDMLWriteMaterials::PropertyWrite(xerce    214 void G4GDMLWriteMaterials::PropertyWrite(xercesc::DOMElement* matElement,
279                                          const    215                                          const G4Material* const mat)
280 {                                                 216 {
281   xercesc::DOMElement* propElement;            << 217    xercesc::DOMElement* propElement;
282   G4MaterialPropertiesTable* ptable = mat->Get << 218    G4MaterialPropertiesTable* ptable = mat->GetMaterialPropertiesTable();
283                                                << 219    const std::map< G4String, G4MaterialPropertyVector*,
284   auto pvec = ptable->GetProperties();         << 220                  std::less<G4String> >* pmap = ptable->GetPropertiesMap();
285   auto cvec = ptable->GetConstProperties();    << 221    const std::map< G4String, G4double,
286                                                << 222                  std::less<G4String> >* cmap = ptable->GetPropertiesCMap();
287   for(size_t i = 0; i < pvec.size(); ++i)      << 223    std::map< G4String, G4MaterialPropertyVector*,
288   {                                            << 224                  std::less<G4String> >::const_iterator mpos;
289     if (pvec[i] != nullptr)                    << 225    std::map< G4String, G4double,
290     {                                          << 226                  std::less<G4String> >::const_iterator cpos;
                                                   >> 227    for (mpos=pmap->begin(); mpos!=pmap->end(); mpos++)
                                                   >> 228    {
291       propElement = NewElement("property");       229       propElement = NewElement("property");
292       propElement->setAttributeNode(           << 230       propElement->setAttributeNode(NewAttribute("name", mpos->first));
293         NewAttribute("name", ptable->GetMateri << 231       propElement->setAttributeNode(NewAttribute("ref",
294       propElement->setAttributeNode(NewAttribu << 232                                     GenerateName(mpos->first, mpos->second)));
295         "ref", GenerateName(ptable->GetMateria << 233       PropertyVectorWrite(mpos->first, mpos->second);
296                             pvec[i])));        << 
297       PropertyVectorWrite(ptable->GetMaterialP << 
298                           pvec[i]);            << 
299       matElement->appendChild(propElement);       234       matElement->appendChild(propElement);
300     }                                          << 235    }
301   }                                            << 236    for (cpos=cmap->begin(); cpos!=cmap->end(); cpos++)
302                                                << 237    {
303   for(size_t i = 0; i < cvec.size(); ++i)      << 
304   {                                            << 
305     if (cvec[i].second == true)                << 
306     {                                          << 
307       propElement = NewElement("property");       238       propElement = NewElement("property");
308       propElement->setAttributeNode(NewAttribu << 239       propElement->setAttributeNode(NewAttribute("name", cpos->first));
309         "name", ptable->GetMaterialConstProper << 240       propElement->setAttributeNode(NewAttribute("ref", cpos->first));
310       propElement->setAttributeNode(NewAttribu << 241       xercesc::DOMElement* constElement = NewElement("constant");
311         "ref", GenerateName(ptable->GetMateria << 242       constElement->setAttributeNode(NewAttribute("name", cpos->first));
312                             ptable)));         << 243       constElement->setAttributeNode(NewAttribute("value", cpos->second));
313       PropertyConstWrite(ptable->GetMaterialCo << 244       defineElement->appendChild(constElement);
314                          cvec[i].first, ptable << 
315       matElement->appendChild(propElement);       245       matElement->appendChild(propElement);
316     }                                          << 246    }
317   }                                            << 
318 }                                                 247 }
319                                                   248 
320 // ------------------------------------------- << 
321 void G4GDMLWriteMaterials::MaterialsWrite(xerc    249 void G4GDMLWriteMaterials::MaterialsWrite(xercesc::DOMElement* element)
322 {                                                 250 {
323 #ifdef G4VERBOSE                               << 251    G4cout << "G4GDML: Writing materials..." << G4endl;
324   G4cout << "G4GDML: Writing materials..." <<  << 252 
325 #endif                                         << 253    materialsElement = NewElement("materials");
326   materialsElement = NewElement("materials");  << 254    element->appendChild(materialsElement);
327   element->appendChild(materialsElement);      << 255 
328                                                << 256    isotopeList.clear();
329   isotopeList.clear();                         << 257    elementList.clear();
330   elementList.clear();                         << 258    materialList.clear();
331   materialList.clear();                        << 
332   propertyList.clear();                        << 
333 }                                                 259 }
334                                                   260 
335 // ------------------------------------------- << 
336 void G4GDMLWriteMaterials::AddIsotope(const G4    261 void G4GDMLWriteMaterials::AddIsotope(const G4Isotope* const isotopePtr)
337 {                                                 262 {
338   for(std::size_t i = 0; i < isotopeList.size( << 263    for (size_t i=0; i<isotopeList.size(); i++)   // Check if isotope is
339   {                                            << 264    {                                             // already in the list!
340     if(isotopeList[i] == isotopePtr)           << 265      if (isotopeList[i] == isotopePtr)  { return; }
341     {                                          << 266    }
342       return;                                  << 267    isotopeList.push_back(isotopePtr);
343     }                                          << 268    IsotopeWrite(isotopePtr);
344   }                                            << 
345   isotopeList.push_back(isotopePtr);           << 
346   IsotopeWrite(isotopePtr);                    << 
347 }                                                 269 }
348                                                   270 
349 // ------------------------------------------- << 
350 void G4GDMLWriteMaterials::AddElement(const G4    271 void G4GDMLWriteMaterials::AddElement(const G4Element* const elementPtr)
351 {                                                 272 {
352   for(std::size_t i = 0; i < elementList.size( << 273    for (size_t i=0;i<elementList.size();i++)     // Check if element is
353   {                                            << 274    {                                             // already in the list!
354     if(elementList[i] == elementPtr)           << 275       if (elementList[i] == elementPtr) { return; }
355     {                                          << 276    }
356       return;                                  << 277    elementList.push_back(elementPtr);
357     }                                          << 278    ElementWrite(elementPtr);
358   }                                            << 
359   elementList.push_back(elementPtr);           << 
360   ElementWrite(elementPtr);                    << 
361 }                                                 279 }
362                                                   280 
363 // ------------------------------------------- << 
364 void G4GDMLWriteMaterials::AddMaterial(const G    281 void G4GDMLWriteMaterials::AddMaterial(const G4Material* const materialPtr)
365 {                                                 282 {
366   for(std::size_t i = 0; i < materialList.size << 283    for (size_t i=0;i<materialList.size();i++)    // Check if material is
367   {                                            << 284    {                                             // already in the list!
368     if(materialList[i] == materialPtr)         << 285       if (materialList[i] == materialPtr)  { return; }
369     {                                          << 286    }
370       return;                                  << 287    materialList.push_back(materialPtr);
371     }                                          << 288    MaterialWrite(materialPtr);
372   }                                            << 
373   materialList.push_back(materialPtr);         << 
374   MaterialWrite(materialPtr);                  << 
375 }                                                 289 }
376                                                   290