Implement more detailed __lt__
for component sorting
#1875
Labels
feature request
Smaller user request
__lt__
for component sorting
#1875
Components on a block are sorted by their
getBoundingCircleOuterDiameter
.armi/armi/reactor/components/component.py
Lines 272 to 288 in abd1db4
Sometimes, two components have the same outer diameter, in which case the sorting done by
__lt__
will depend on the order of comparison. i.e.,a < b
evaluates toFalse
b < a
also evaluates toFalse
As a result,
sorted([a, b]) = [a, b]
while
sorted([b, a]) = [b, a]
Ideally, the outcome of
sorted
will not be dependent on the order of the input.We should fall back to
getCircleInnerDiameter
for comparison when sorting components whengetBoundingCircleOuterDiameter
is equivalent. I pushed an example of what I think the sorting should do here:main...component_sort
The text was updated successfully, but these errors were encountered: