Skip to content

Commit

Permalink
adapt the openmc-update-inputs script for surfaces (#3131)
Browse files Browse the repository at this point in the history
Co-authored-by: r.haddad <[email protected]>
  • Loading branch information
rayanhaddad169 and r.haddad authored Oct 3, 2024
1 parent 9686851 commit 3a5b218
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/openmc-update-inputs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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)

0 comments on commit 3a5b218

Please sign in to comment.