mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Simplified universe cloning in lattice clone method
This commit is contained in:
parent
400b5e2c1d
commit
d0f871e7db
2 changed files with 6 additions and 12 deletions
|
|
@ -443,23 +443,17 @@ class Lattice(object):
|
|||
if self.outer is not None:
|
||||
clone.outer = self.outer.clone(memo)
|
||||
|
||||
# Clone all unique universes in the lattice
|
||||
univ_clones = self.get_unique_universes()
|
||||
for univ_id in univ_clones:
|
||||
univ_clones[univ_id] = univ_clones[univ_id].clone(memo)
|
||||
|
||||
# Assign universe clones to the lattice clone
|
||||
for i in self.indices:
|
||||
if isinstance(self, RectLattice):
|
||||
univ_id = self.universes[i].id
|
||||
clone.universes[i] = univ_clones[univ_id]
|
||||
clone.universes[i] = self.universes[i].clone()
|
||||
else:
|
||||
if self.ndim == 2:
|
||||
univ_id = self.universes[i[0]][i[1]].id
|
||||
clone.universes[i[0]][i[1]] = univ_clones[univ_id]
|
||||
clone.universes[i[0]][i[1]] = \
|
||||
self.universes[i[0]][i[1]].clone()
|
||||
else:
|
||||
univ_id = self.universes[i[0]][i[1]][i[2]].id
|
||||
clone.universes[i[0]][i[1]][i[2]] = univ_clones[univ_id]
|
||||
clone.universes[i[0]][i[1]][i[2]] = \
|
||||
self.universes[i[0]][i[1]][i[2]].clone()
|
||||
|
||||
# Memoize the clone
|
||||
memo[self] = clone
|
||||
|
|
|
|||
|
|
@ -816,7 +816,7 @@ class Material(object):
|
|||
"""
|
||||
|
||||
if memo is None:
|
||||
memo = dict
|
||||
memo = {}
|
||||
|
||||
# If no nemoize'd clone exists, instantiate one
|
||||
if self not in memo:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue