From f51f18176135926ea1c4be5f2287c95a8741c8fd Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Mon, 21 Nov 2022 11:53:49 -0500 Subject: [PATCH] fixed optional xml reading --- openmc/mesh.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/openmc/mesh.py b/openmc/mesh.py index 0d92208aa1..31b7789ee1 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -1269,8 +1269,7 @@ class CylindricalMesh(StructuredMesh): mesh.r_grid = [float(x) for x in get_text(elem, "r_grid").split()] mesh.phi_grid = [float(x) for x in get_text(elem, "phi_grid").split()] mesh.z_grid = [float(x) for x in get_text(elem, "z_grid").split()] - if "origin" in elem.attrib: - mesh.origin = [float(x) for x in get_text(elem, "origin").split()] + mesh.origin = [float(x) for x in get_text(elem, "origin", default=[0., 0., 0.]).split()] return mesh @@ -1526,8 +1525,7 @@ class SphericalMesh(StructuredMesh): mesh.r_grid = [float(x) for x in get_text(elem, "r_grid").split()] mesh.theta_grid = [float(x) for x in get_text(elem, "theta_grid").split()] mesh.phi_grid = [float(x) for x in get_text(elem, "phi_grid").split()] - if "origin" in elem.attrib: - mesh.origin = [float(x) for x in get_text(elem, "origin").split()] + mesh.origin = [float(x) for x in get_text(elem, "origin", default=[0., 0., 0.]).split()] return mesh