From 177f3d1423f5db7d7fb8bbd2ab50df39ffd56f11 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 5 Mar 2019 11:08:27 -0600 Subject: [PATCH] Correction to memoization for xml export. --- openmc/cell.py | 2 +- openmc/lattice.py | 6 +++--- openmc/universe.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openmc/cell.py b/openmc/cell.py index 36f772ff5..bb59b1d3a 100644 --- a/openmc/cell.py +++ b/openmc/cell.py @@ -503,7 +503,7 @@ class Cell(IDManagerMixin): path = "./surface[@id='{}']".format(node.surface.id) if memo and node.surface.id in memo['surfaces']: return - if memo: + if memo is not None: memo['surfaces'].add(node.surface.id) xml_element.append(node.surface.to_xml_element()) diff --git a/openmc/lattice.py b/openmc/lattice.py index 985fec86e..dff00306a 100644 --- a/openmc/lattice.py +++ b/openmc/lattice.py @@ -467,7 +467,7 @@ class Lattice(IDManagerMixin, metaclass=ABCMeta): if memo is None: memo = {} - # If no nemoize'd clone exists, instantiate one + # If no memoize'd clone exists, instantiate one if self not in memo: clone = deepcopy(self) clone.id = None @@ -760,7 +760,7 @@ class RectLattice(Lattice): # If the element does contain the Lattice subelement, then return if memo and self._id in memo['lattices']: return - if memo: + if memo is not None: memo['lattices'].add(self._id) lattice_subelement = ET.Element("lattice") @@ -1282,7 +1282,7 @@ class HexLattice(Lattice): # If the element does contain the Lattice subelement, then return if memo and self._id in memo['lattices']: return - if memo: + if memo is not None: memo['lattices'].add(self._id) lattice_subelement = ET.Element("hex_lattice") diff --git a/openmc/universe.py b/openmc/universe.py index 7a9411ecf..ea8c7f294 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -519,7 +519,7 @@ class Universe(IDManagerMixin): # If the cell was not already written, write it if memo and cell_id in memo['cells']: continue - if memo: + if memo is not None: memo['cells'].add(cell_id) # Create XML subelement for this Cell