From b63ec9cdc3ee988afe1051126cdba2b7d83ff629 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Mon, 21 Nov 2022 09:48:42 -0500 Subject: [PATCH] read mesh optional --- openmc/mesh.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/openmc/mesh.py b/openmc/mesh.py index 64217fa77..0d92208aa 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -1145,7 +1145,8 @@ class CylindricalMesh(StructuredMesh): mesh.r_grid = group['r_grid'][()] mesh.phi_grid = group['phi_grid'][()] mesh.z_grid = group['z_grid'][()] - mesh.origin = group['origin'][()] + if 'origin' in group: + mesh.origin = group['origin'][()] return mesh @@ -1268,7 +1269,8 @@ 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()] - mesh.origin = [float(x) for x in get_text(elem, "origin").split()] + if "origin" in elem.attrib: + mesh.origin = [float(x) for x in get_text(elem, "origin").split()] return mesh @@ -1470,7 +1472,8 @@ class SphericalMesh(StructuredMesh): mesh.r_grid = group['r_grid'][()] mesh.theta_grid = group['theta_grid'][()] mesh.phi_grid = group['phi_grid'][()] - mesh.origin = group['origin'][()] + if 'origin' in group: + mesh.origin = group['origin'][()] return mesh @@ -1523,7 +1526,8 @@ 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()] - mesh.origin = [float(x) for x in get_text(elem, "origin").split()] + if "origin" in elem.attrib: + mesh.origin = [float(x) for x in get_text(elem, "origin").split()] return mesh