Skip to content

Add analytic tests for ray-traced intersection distances#4014

Open
mazy1998 wants to merge 1 commit into
openmc-dev:developfrom
mazy1998:codex/test-ray-distances
Open

Add analytic tests for ray-traced intersection distances#4014
mazy1998 wants to merge 1 commit into
openmc-dev:developfrom
mazy1998:codex/test-ray-distances

Conversation

@mazy1998

Copy link
Copy Markdown

Description

Add focused C++ unit tests for Ray::trace() using a concentric-sphere CSG geometry.

The tests verify:

  • the analytic chord length through a sphere, 2 * sqrt(R^2 - b^2);
  • all four cumulative intersection distances for a ray crossing a spherical shell and its inner region.

Together, these cases exercise entry from outside the model, multiple internal surface crossings, re-entry into a cell, and final leakage through a vacuum boundary. This adds direct analytic coverage for the reusable Ray implementation generalized in #3816 and separated into its own source files in #3845.

No production behavior or public API is changed.

Testing

  • cmake --build build --target test_ray -j2
  • ctest --test-dir build -R '^test_ray$' --output-on-failure
  • All nine locally available C++ test executables pass; the optional MCPL test was excluded because MCPL is not installed.
  • A local mutation check confirmed the assertions detect TINY_BIT-scale errors in accumulated traversal distances.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on the C++ source file
  • I have followed the style guidelines for Python source files (not applicable)
  • I have made corresponding changes to the documentation (not applicable; test-only change)
  • I have added tests that prove the covered behavior works

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