Overlapping Visualization for Plotter#179
Draft
viktormai wants to merge 4 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR includes the plotter-side code corresponding to #3969 in the OpenMC main branch, allowing the plotter to use the information received from the C API via
openmc.lib.slice_data_overlap_info(). A simple input file will be included for visualization purposes of overlapping regions with the plotter.overlap_test.py
Changes
getIDinfo: Read hover IDs directly from cell_ids/mat_ids (i.e. raw geom_data) instead of the processed self.ids. This preserves the encoded overlap index (e.g. -4, -5) which is needed to look up the correct entry in overlap_map.mouseMoveEvent:Checkselif id < _OVERLAP, which decodes the overlap index via_OVERLAP - id - 1and looks it up inoverlap_mapto display universe and cell info. Cell names are shown if available, falling back to IDs.contextMenuEvent: Changeid not in (_NOT_FOUND, _OVERLAP)toid >= _OVERLAPso that overlap pixels (which now carry values more negative than -3) are correctly excluded from the domain color/mask/highlight context menu.overlap_map: Initialized to {} at model construction and populated after everymakePlotcall by readingslice_data_overlap_info().self.idsis now a copy of cell_ids/mat_ids rather than a direct reference. This is necessary because the normalization step mutates the array in place — without the copy it would corruptgeom_dataitself, breaking the raw index lookups ingetIDinfo.self.ids[self.ids < _OVERLAP] = _OVERLAPclamps all encoded overlap indices down to -3 inself.ids. This is required becauseself.idsis used for image construction viadomain[id].color, andDomainViewDictonly has entries for real domain IDs plus the sentinel values_OVERLAP,_NOT_FOUND, and_VOID_REGION— passing -4, -5, etc. would raise aKeyError. The raw values are still accessible via cell_ids/mat_ids for hover lookup.