mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Fix write speed degradation
This commit is contained in:
parent
40ec4a20f1
commit
b083e35f2e
1 changed files with 6 additions and 4 deletions
|
|
@ -1190,15 +1190,17 @@ class Materials(cv.CheckedList):
|
|||
element = ET.Element('cross_sections')
|
||||
element.text = str(self._cross_sections)
|
||||
clean_indentation(element, level=1)
|
||||
out = ET.tostring(element, encoding='utf-8').strip()
|
||||
fh.write(' ' + str(out, encoding='utf-8') + '\n')
|
||||
element.tail = element.tail.strip(' ')
|
||||
fh.write(' ')
|
||||
ET.ElementTree(element).write(fh, encoding='unicode')
|
||||
|
||||
# Write the <material> elements.
|
||||
for material in sorted(self, key=lambda x: x.id):
|
||||
element = material.to_xml_element(self.cross_sections)
|
||||
clean_indentation(element, level=1)
|
||||
out = ET.tostring(element, encoding='utf-8').strip()
|
||||
fh.write(' ' + str(out, encoding='utf-8') + '\n')
|
||||
element.tail = element.tail.strip(' ')
|
||||
fh.write(' ')
|
||||
ET.ElementTree(element).write(fh, encoding='unicode')
|
||||
|
||||
# Write the closing tag for the root element.
|
||||
fh.write('</materials>\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue