Skip to content

Provide a way to get ID maps from plot parameters on the Model class #3481

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

pshriwise
Copy link
Contributor

Description

This pull request introduces a new method, id_map, to the openmc.Model class for generating ID maps based on slice plot parameters, along with corresponding unit tests to validate its functionality. The changes enhance the modeling capabilities and ensure robust testing for the new feature.

It is also possible to do this using the openmc.lib module directly, but it is tedious and requires direct use of an internal object, openmc.lib.__PlotBase.

Enhancements to openmc.Model:

  • Added id_map method: The id_map method generates a NumPy array representing IDs for cells, cell instances, and materials based on plot parameters. It initializes the model if not already initialized and ensures proper finalization after execution.

Unit Tests for id_map:

  • Added test_model_id_map function: This test verifies the correctness of the id_map method by checking the array's shape, data type, and validity of cell/material IDs. It also ensures proper initialization and finalization behavior depending on the model's state.

Checklist

  • [] I have performed a self-review of my own code
  • I have run clang-format (version 15) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

…sis indices; update test_model.py accordingly
@pshriwise pshriwise changed the title Provide a way to get ID maps from a plot on the Model class Provide a way to get ID maps from plot parameters on the Model class Jul 2, 2025
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.

2 participants