Skip to content

Overlapping Visualization for Plotter#179

Draft
viktormai wants to merge 4 commits into
openmc-dev:developfrom
viktormai:overlaps-for-plotter-fixed
Draft

Overlapping Visualization for Plotter#179
viktormai wants to merge 4 commits into
openmc-dev:developfrom
viktormai:overlaps-for-plotter-fixed

Conversation

@viktormai

Copy link
Copy Markdown

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: Checks elif id < _OVERLAP, which decodes the overlap index via _OVERLAP - id - 1 and looks it up in overlap_map to display universe and cell info. Cell names are shown if available, falling back to IDs.
  • contextMenuEvent: Change id not in (_NOT_FOUND, _OVERLAP) to id >= _OVERLAP so 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 every makePlot call by reading slice_data_overlap_info().
  • self.ids is 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 corrupt geom_data itself, breaking the raw index lookups in getIDinfo.
  • Normalization: self.ids[self.ids < _OVERLAP] = _OVERLAP clamps all encoded overlap indices down to -3 in self.ids. This is required because self.ids is used for image construction via domain[id].color, and DomainViewDict only has entries for real domain IDs plus the sentinel values _OVERLAP, _NOT_FOUND, and _VOID_REGION — passing -4, -5, etc. would raise a KeyError. The raw values are still accessible via cell_ids/mat_ids for hover lookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant