Skip to content

Conversation

@andrsd
Copy link
Contributor

@andrsd andrsd commented Jan 31, 2026

Description

SpatialBox can be constructed from a C++ code via a constructor that takes lower_left, upper_right, and fission parameters. Before this change, SpatialBox was constructible only by supplying an XML node.

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)

@GuySten
Copy link
Contributor

GuySten commented Jan 31, 2026

What is the intended use case for this PR?

@andrsd
Copy link
Contributor Author

andrsd commented Jan 31, 2026

What is the intended use case for this PR?

We have a C++ code that is build around openmc. The code needs to construct IndependentSource which takes space, angle, energy, and time distribution. So if we want to supply SpatialBox into the ctor, for spatial distribution we need to be able to construct it (through other means than by supplying an XML node).

For example, SpatialPoint can be constructed without using an XML node, so this felt like a logical extension...

@pshriwise
Copy link
Contributor

Makes sense to me! I'm a fan of using the C++ API in other applications, though we have some work to do to make that easier in the future. If this suits your needs, sounds good to me!

I know this is a pretty trivial constructor, but as a matter of practice would you be willing to add a quick C++ test @andrsd so we're exercising it regularly? Otherwise maybe @GuySten or I could tag one on for you?

@andrsd
Copy link
Contributor Author

andrsd commented Jan 31, 2026

I know this is a pretty trivial constructor, but as a matter of practice would you be willing to add a quick C++ test

I think I can build a simple unit test for this. I will ping you guys if I need any help...

I'm a fan of using the C++ API in other applications, though we have some work to do to make that easier in the future.

Glad to hear that! I think our ongoing efforts will test the C++ API this way. There might be more patches like this one in future as we progress.

Copy link
Contributor

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

Thanks @andrsd!

@pshriwise pshriwise merged commit 6041ee6 into openmc-dev:develop Jan 31, 2026
17 checks passed
@andrsd
Copy link
Contributor Author

andrsd commented Feb 1, 2026

o7

@andrsd andrsd deleted the spatial-box-ctor branch February 1, 2026 13:03
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.

4 participants