From cec3df43d5000f98bbd6a1a49a909876ca73db13 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 11 Aug 2016 10:26:49 -0500 Subject: [PATCH] If OpenCG cell has no surfaces, don't assign region --- openmc/opencg_compatible.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/openmc/opencg_compatible.py b/openmc/opencg_compatible.py index 93a257f465..d301cf2b5e 100644 --- a/openmc/opencg_compatible.py +++ b/openmc/opencg_compatible.py @@ -689,13 +689,14 @@ def get_openmc_cell(opencg_cell): translation = np.asarray(opencg_cell.translation, dtype=np.float64) openmc_cell.translation = translation - surfaces = [] - operators = [] - for surface, halfspace in opencg_cell.surfaces.values(): - surfaces.append(get_openmc_surface(surface)) - operators.append(operator.neg if halfspace == -1 else operator.pos) - openmc_cell.region = openmc.Intersection( - *[op(s) for op, s in zip(operators, surfaces)]) + if opencg_cell.surfaces: + surfaces = [] + operators = [] + for surface, halfspace in opencg_cell.surfaces.values(): + surfaces.append(get_openmc_surface(surface)) + operators.append(operator.neg if halfspace == -1 else operator.pos) + openmc_cell.region = openmc.Intersection( + *[op(s) for op, s in zip(operators, surfaces)]) # Add the OpenMC Cell to the global collection of all OpenMC Cells OPENMC_CELLS[cell_id] = openmc_cell