Skip to content

C-API bindings for key random ray functions#3749

Merged
jtramm merged 6 commits intoopenmc-dev:developfrom
nuclearkevin:rr_c_api
Feb 6, 2026
Merged

C-API bindings for key random ray functions#3749
jtramm merged 6 commits intoopenmc-dev:developfrom
nuclearkevin:rr_c_api

Conversation

@nuclearkevin
Copy link
Contributor

@nuclearkevin nuclearkevin commented Jan 23, 2026

Description

This brief PR adds the random ray run function to the C-API, with inclusions in the openmc.lib Python bindings. This provides a frontend for wrapper applications which want to expose the random ray solver for multiphysics.

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)

@jtramm
Copy link
Contributor

jtramm commented Jan 23, 2026

Do we currently have a way in the CI to test the C-API calls? I'm guessing not, but if we happen to already be testing other portions of the C-API, then might as well here, too.

@nuclearkevin
Copy link
Contributor Author

In this case the C-API functions are getting implicitly hit by all of the random ray tests, as the C-API functions are used when resetting and running the random ray solver in OpenMC proper. I can definitely add a test for openmc.lib additions though

- This is handled in openmc_finalize
- Also rename openmc_reset_random_ray to openmc_finalize_random_ray (more clear IMO)
@nuclearkevin
Copy link
Contributor Author

nuclearkevin commented Jan 24, 2026

Added a test for openmc_run_random_ray(). I also elected to remove the openmc_reset_random_ray() function from the C-API / Python bindings as it's called in openmc_finalize().

Additionally, I renamed openmc_reset_random_ray() to openmc_finalize_random_ray() to account for the fact that the data structures cleared cannot be repopulated without re-initializing the simulation (from XML files).

Copy link
Contributor

@jtramm jtramm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me -- thanks @nuclearkevin!

@jtramm jtramm merged commit 14acc76 into openmc-dev:develop Feb 6, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants