mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 05:05:30 -04:00
Simplified Universe equality operator per @paulromano suggestion
This commit is contained in:
parent
e3052fd315
commit
572000419d
2 changed files with 6 additions and 13 deletions
|
|
@ -56,11 +56,11 @@ class Lattice(object):
|
|||
return False
|
||||
elif self.name != other.name:
|
||||
return False
|
||||
elif self.pitch != other.pitch:
|
||||
elif np.any(self.pitch != other.pitch):
|
||||
return False
|
||||
elif self.outer != other.outer:
|
||||
return False
|
||||
elif self.universes != other.universes:
|
||||
elif np.any(self.universes != other.universes):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
|
@ -533,7 +533,7 @@ class RectLattice(Lattice):
|
|||
return False
|
||||
elif self.shape != other.shape:
|
||||
return False
|
||||
elif self.lower_left != other.lower_left:
|
||||
elif np.any(self.lower_left != other.lower_left):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -76,17 +76,10 @@ class Universe(object):
|
|||
return False
|
||||
elif self.name != other.name:
|
||||
return False
|
||||
elif len(self.cells) != len(other.cells):
|
||||
elif dict.__eq__(self.cells, other.cells):
|
||||
return False
|
||||
|
||||
# Check each cell
|
||||
for cell_id in self.cells:
|
||||
if cell_id not in other.cells:
|
||||
return False
|
||||
if self.cells[cell_id] != other.cells[cell_id]:
|
||||
return False
|
||||
|
||||
return True
|
||||
else:
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue