Skip to content

Commit

Permalink
Removing addRing - the Reactor might not have rings
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Aug 6, 2022
1 parent e19b748 commit 34a166c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 65 deletions.
22 changes: 0 additions & 22 deletions armi/reactor/tests/test_zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,6 @@ def test_index(self):
for i, loc in enumerate(zone.locList):
self.assertEqual(i, zone.index(loc))

def test_addRing(self):
zone = zones.Zone("TestZone")
zone.addRing(5)
self.assertIn("005-003", zone)
self.assertNotIn("006-002", zone)

zone.addRing(6, 3, 9)
self.assertIn("006-003", zone)
self.assertIn("006-009", zone)
self.assertNotIn("006-002", zone)
self.assertNotIn("006-010", zone)

def test_add(self):
zone = zones.Zone("TestZone")
zone.addRing(5)
otherZone = zones.Zone("OtherZone")
otherZone.addRing(6, 3, 9)
combinedZoneList = zone + otherZone
self.assertIn("005-003", combinedZoneList)
self.assertIn("006-003", combinedZoneList)
self.assertIn("006-009", combinedZoneList)


class Zones_InReactor(unittest.TestCase):
def setUp(self):
Expand Down
45 changes: 2 additions & 43 deletions armi/reactor/zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class Zone:
def __init__(self, name, locations=None, symmetry=3):
self.symmetry = symmetry
self.name = name
if locations is None:
locations = []
self.locList = locations
if locations is None:
self.locList = []
self.hostZone = name

def __repr__(self):
Expand All @@ -53,10 +53,6 @@ def index(self, loc):
def __len__(self):
return len(self.locList)

def __add__(self, other):
"""Returns all the blocks in both assemblies."""
return self.locList + other.locList

def append(self, obj):
if obj in self.locList:
# locations must be unique
Expand All @@ -75,43 +71,6 @@ def addAssemblyLocations(self, aList):
for a in aList:
self.append(a.getLocation())

# TODO: p0, p1 are only used in testing
def addRing(self, ring, p0=None, p1=None):
"""
Adds a section of a ring (or a whole ring) to the zone
Parameters
----------
ring : int
The ring to add
p0 : int, optional
beginning position within ring. Default: None (full ring)
p1 : int, optional
Ending position within ring.
"""
grid = grids.HexGrid.fromPitch(1.0)
if p0 is None or p1 is None:
if self.symmetry == 3:
posList = grid.allPositionsInThird(ring)
elif self.symmetry == 1:
posList = range(1, grid.getPositionsInRing(ring) + 1)
else:
raise RuntimeError(
"Zones are not written to handle {0}-fold symmetry yet"
"".format(self.symmetry)
)
else:
posList = range(p0, p1 + 1)

for pos in posList:
newLoc = grid.getLabel(
grid.getLocatorFromRingAndPos(ring, pos).getCompleteIndices()[:2]
)
if newLoc not in self.locList:
self.append(newLoc)


class Zones:
"""Collection of Zone objects."""
Expand Down

0 comments on commit 34a166c

Please sign in to comment.