Skip to content

Commit

Permalink
resolve fixme
Browse files Browse the repository at this point in the history
  • Loading branch information
albeanth committed Nov 5, 2024
1 parent 937057c commit e657ce9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions armi/reactor/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from armi.nucDirectory import nuclideBases
from armi.reactor import composites
from armi.reactor import flags
from armi.reactor import grids
from armi.reactor import parameters
from armi.reactor.components import componentParameters
from armi.utils import densityTools
Expand Down Expand Up @@ -1291,13 +1290,7 @@ def getPinMgFluxes(
a pin.
"""
# Get the (i, j, k) location of all pins from the parent block
# FIXME: This should be changed to just using Block.getPinLocations once Drew's PR is merged
indicesAll = []
for clad in self.parent.getChildrenWithFlags(flags.Flags.CLAD):
if isinstance(clad.spatialLocator, grids.MultiIndexLocation):
indicesAll.extend(clad.spatialLocator.indices)
else:
indicesAll.append(clad.spatialLocator.indices)
indicesAll = self.parent.getPinLocations()

# Retrieve the indices of this component
indices = self.spatialLocator.indices
Expand All @@ -1306,7 +1299,7 @@ def getPinMgFluxes(

# Map this component's indices to block's pin indices
getIndex = lambda ind: next(
(i for i, indA in enumerate(indicesAll) if np.all(ind == indA)),
(i for i, indA in enumerate(indicesAll) if np.all(ind == indA.indices)),
None,
)
indexMap = list(map(getIndex, indices))
Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ def test_getPinMgFluxes(self):
assert_equal(pinMgFluxesGamma, simPinMgFluxesGamma)

# Mock the spatial locator of the component to raise error
fuelComponent.spatialLocator = Mock()
fuelComponent.spatialLocator = unittest.mock.Mock()
fuelComponent.spatialLocator.indices = [np.array([111, 111, 111])]
with self.assertRaises(ValueError):
fuelComponent.getPinMgFluxes()

0 comments on commit e657ce9

Please sign in to comment.