Introduce new C API function for slice plots#3806
Open
paulromano wants to merge 14 commits intoopenmc-dev:developfrom
Open
Introduce new C API function for slice plots#3806paulromano wants to merge 14 commits intoopenmc-dev:developfrom
paulromano wants to merge 14 commits intoopenmc-dev:developfrom
Conversation
Contributor
Author
|
If any of you want to try this out in the plotter, I've just put up a draft PR there: openmc-dev/plotter#172. |
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.
Description
This PR introduces a new
openmc_slice_plotC API function that addresses several limitations of the existing API:openmc_id_map(for cell/material IDs) andopenmc_property_map(for densities/temperatures). Both of these calls involve the same loop over pixels with a "find cell" call at each pixel. In theopenmc_slice_plotfunction, both IDs and properties are retrieved at the same time, which will reduce the time for each slice plot in the plotter by 2×.openmc_filter_get_plot_binsfunction that is similar to the existingopenmc_mesh_get_plot_bins, but once again this would involve another loop over pixels with "find cell" calls (because filters rely on a properly constructed particle with geometry state information). Instead, I've designedopenmc_slice_plotto optionally take a filter index and return matching bin indices for each pixel. This will both speed up tally visualization in the plotter and allow us to plot things we can't currently (likeMeshMaterialFilter).openmc_slice_plotis more general and allows arbitrary orientation slice plots by specifying two orthogonal span vectors that define the view.openmc_id_mapandopenmc_property_mapcalls rely on a struct that has to be created on the Python side matching the C struct internally, which has always felt awkward to me.openmc_slice_plotis designed to take plain basic datatypes to avoid this.Design questions
id_map,property_map, and_PlotBasearound sinceslice_plotsubsumes their capability.Modelclass? Currently I have a separateslice_plotmethod but arguably it can (should?) be integrated into the existingplotmethod?Checklist