Add constant for invalid surface tokens. #3260
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As I was going through some of the plotting code I noticed that through out the code we use a value of
0
for an invalid surface token. Here, token meaning a signed, off-by-one index as opposed to a signed surface ID.The "magic number" is a little confusing when we're constantly converting between tokens and indices into the
model::surfaces
vector. Further, we initializeBoundaryInfo.surface_index
to0
because this member is really a token rather than an index.In an effort to distinguish surface token values I've added a
SURFACE_NONE
constexpr that is0
for these cases.I've also updated
BoundaryInfo::surface_index
attribute tosurface
in an effort to be consistent with theGeometryState::surface_
attribute and addedBoundaryInfo|GeometryState::surface_index
methods that convert from the token to the index for that token. This doesn't cover all of the cases where we do this conversion, but I think it generally increases clarity weresurface
indicates a token andsurface_index
an index.sUpdate
It's worth noting that there's a fix for the surface index passed into the DAGMC
next_cell
call for projection plots. The off-by-one used to be handled innext_cell
but the argument passed in was already adjustment, so this was happening twice.Checklist
I have followed the style guidelines for Python source files (if applicable)N/AI have added tests that prove my fix is effective or that my feature works (if applicable)N/A