-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide more Composite.iter* methods #1915
Comments
Future workThings that could be looked at later
Non-exhaustive |
If I were to be choosy, I would do Just thinking aloud. |
Agree. I don't intend on tackling things outside |
Some additional digging.
That mode, armi/armi/reactor/composites.py Line 2778 in f1f3dbe
armi/armi/reactor/composites.py Line 2884 in f1f3dbe
But armi/armi/reactor/composites.py Lines 2535 to 2536 in f1f3dbe
There are few recursive usage of armi/armi/bookkeeping/visualization/vtk.py Lines 100 to 103 in f1f3dbe
So maybe some wide-spread improvements could be
|
ARMI does a lot of iteration over the composite tree. Understandably so, we have lots of methods that support iterating over children of an object, with some filtering. These usually follow the pattern of
parent.getChildren*
likeComposite.getChildren
,Composite.getChildrenWithFlags
, andComposite.getChildrenOfType
, further expanded to things likeAssembly.getBlocks
.A lot of instances of the usage of these
get*
methods are for iterationarmi/armi/reactor/components/component.py
Line 965 in 96a5c88
armi/armi/reactor/converters/axialExpansionChanger/expansionData.py
Line 253 in 96a5c88
armi/armi/reactor/blocks.py
Line 633 in 96a5c88
The tradeoff is these
get*
methods create and populate lists, and then return those lists back to the user. This is great if you need to do multiple iterations or check sizing of the returned object, but it's inefficient for iteration.I propose we provide
iter*
methods with similar signatures as theirget*
counterparts that do not return lists of things. Instead, they couldyield
back components, produce afilter
object, etc. something that allows one-pass iteration over things. Theget*
methods could then be distilled tofor backwards compatibility.
Candidate methods
To keep the scope clear, I propose we add, test, and use (where appropriate)
Composite.iterChildren
Composite.iterChildrenWithFlags
Composite.iterChildrenOfType
There are other composite subclasses that I believe could benefit from more iteration methods. But for start, I'll keep the scope limited to
Composite
methodsThe text was updated successfully, but these errors were encountered: