mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Don't copy _paths when cloning Cell or Material
This commit is contained in:
parent
897db1389d
commit
81fcd19ec6
2 changed files with 18 additions and 1 deletions
|
|
@ -527,8 +527,16 @@ class Cell(object):
|
|||
|
||||
# If no nemoize'd clone exists, instantiate one
|
||||
if self not in memo:
|
||||
# Temporarily remove paths
|
||||
paths = self.paths
|
||||
self._paths = None
|
||||
|
||||
clone = deepcopy(self)
|
||||
clone.id = None
|
||||
|
||||
# Restore paths on original instance
|
||||
self._paths = paths
|
||||
|
||||
if self.region is not None:
|
||||
clone.region = self.region.clone(memo)
|
||||
if self.fill is not None:
|
||||
|
|
@ -542,7 +550,7 @@ class Cell(object):
|
|||
memo[self] = clone
|
||||
|
||||
return memo[self]
|
||||
|
||||
|
||||
def create_xml_subelement(self, xml_element):
|
||||
element = ET.Element("cell")
|
||||
element.set("id", str(self.id))
|
||||
|
|
|
|||
|
|
@ -820,9 +820,18 @@ class Material(object):
|
|||
|
||||
# If no nemoize'd clone exists, instantiate one
|
||||
if self not in memo:
|
||||
# Temporarily remove paths -- this is done so that when the clone is
|
||||
# made, it doesn't create a copy of the paths (which are specific to
|
||||
# an instance)
|
||||
paths = self.paths
|
||||
self._paths = None
|
||||
|
||||
clone = deepcopy(self)
|
||||
clone.id = None
|
||||
|
||||
# Restore paths on original instance
|
||||
self._paths = paths
|
||||
|
||||
# Memoize the clone
|
||||
memo[self] = clone
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue