mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
adapt the openmc-update-inputs script for surfaces (#3131)
Co-authored-by: r.haddad <r.haddad@naarea.fr>
This commit is contained in:
parent
9686851e7a
commit
3a5b218728
1 changed files with 12 additions and 4 deletions
|
|
@ -1,7 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Update OpenMC's input XML files to the latest format.
|
||||
|
||||
"""
|
||||
"""Update OpenMC's input XML files to the latest format."""
|
||||
|
||||
import argparse
|
||||
from itertools import chain
|
||||
|
|
@ -201,6 +199,16 @@ def update_geometry(geometry_root):
|
|||
|
||||
was_updated = True
|
||||
|
||||
for surface in root.findall('surface'):
|
||||
for attribute in ['type', 'coeffs', 'boundary']:
|
||||
if surface.find(attribute) is not None:
|
||||
value = surface.find(attribute).text
|
||||
surface.attrib[attribute] = value
|
||||
|
||||
child_element = surface.find(attribute)
|
||||
surface.remove(child_element)
|
||||
was_updated = True
|
||||
|
||||
# Remove 'type' from lattice definitions.
|
||||
for lat in root.iter('lattice'):
|
||||
elem = lat.find('type')
|
||||
|
|
@ -296,4 +304,4 @@ if __name__ == '__main__':
|
|||
move(fname, fname + '.original')
|
||||
|
||||
# Write a new geometry file.
|
||||
tree.write(fname, xml_declaration=True)
|
||||
tree.write(fname, xml_declaration=True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue