mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Adjust the read_meshes function to search only for mesh elements directly below the element passed in
This commit is contained in:
parent
fc67b38ba4
commit
283e3ee6aa
2 changed files with 15 additions and 5 deletions
|
|
@ -1940,12 +1940,22 @@ class UnstructuredMesh(MeshBase):
|
|||
return cls(filename, library, mesh_id, '', length_multiplier)
|
||||
|
||||
|
||||
def read_meshes(tree):
|
||||
"""Reads all mesh nodes under an XML tree
|
||||
def read_meshes(elem):
|
||||
"""Reads all mesh nodes under a a given XML node
|
||||
|
||||
Parameters
|
||||
----------
|
||||
elem : xml.etree.ElementTree.Element
|
||||
XML element
|
||||
|
||||
Returns
|
||||
-------
|
||||
OrderedDict
|
||||
An ordered dictionary with mesh IDs as keys and openmc.MeshBase
|
||||
instanaces as values
|
||||
"""
|
||||
out = OrderedDict()
|
||||
root = tree.getroot()
|
||||
for mesh_elem in root.iter('mesh'):
|
||||
for mesh_elem in elem.findall('mesh'):
|
||||
mesh = MeshBase.from_xml_element(mesh_elem)
|
||||
out[mesh.id] = mesh
|
||||
|
||||
|
|
|
|||
|
|
@ -1762,5 +1762,5 @@ class Settings:
|
|||
"""
|
||||
tree = ET.parse(path)
|
||||
root = tree.getroot()
|
||||
meshes = read_meshes(tree)
|
||||
meshes = read_meshes(root)
|
||||
return cls.from_xml_element(root, meshes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue