You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix plotting outside lattices without an outer universe - #4253
Currently, a slice plot can segfault when a lattice has no outer universe and its containing cell extends beyond the lattice. The geometry lookup marks the state as lost but then tries to continue without a valid lower-level universe index.
To enable plotting to work in this case, this PR changes the geometry search to return false before descending when a point lies outside a lattice with no outer universe.
AI Assistance
Harness: Codex
Model: GPT-6.2-Sol
Reasoning effort: high
Checklist
I have performed a self-review of my own code
I have run clang-format (version 18) 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)
Summary by CodeRabbit
Bug Fixes
Improved handling of particles and rays when cell searches fail, preventing further initialization or coordinate processing after an unsuccessful search.
Corrected behavior for particles outside a lattice without an outer universe.
Fixed lattice slice results so pixels outside the lattice are marked separately from interior pixels.
No actionable comments were generated in the recent review.
Walkthrough
The changes adjust how geometry lookup failures are handled in parent-cell searches, lattice lookup, and random-ray initialization. A unit test checks slice cell IDs for a lattice without an outer universe.
Lattice lookup returns false when indices are invalid and no outer universe is configured. Parent-cell search falls back to exhaustive_find_parent_cells(instance) when cell lookup fails. Random-ray initialization returns after a failed lookup marks the ray lost. The new slice test checks cell IDs outside and inside the lattice.
This change prevents slice plots from crashing when a cell extends beyond a lattice that has no outer universe. Undefined regions are now reported as unfound, with a regression test for the slice case. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "Fix plotting outside lattices without an outer universe" matches the main change. The PR stops a segfault in slice plots when a point lies outside a lattice that has no outer universe. The …
Description check
The description states the problem, gives a minimal working example, and explains the fix. The AI assistance section is filled in with harness, model, and reasoning effort. The checklist is marked. It…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Fix plotting outside lattices without an outer universe" matches the main change. The PR stops a segfault in slice plots when a point lies outside a lattice that has no outer universe. The title names the bug and the affected case. It does not name the code change itself, but that is expected.
Full details: Description check
Explanation
The description states the problem, gives a minimal working example, and explains the fix. The AI assistance section is filled in with harness, model, and reasoning effort. The checklist is marked. It does not link an issue under 'Fixes # (issue)', and it does not name the regression test added. The description is mostly complete, so the check passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: e62a2a89-4b54-41f0-985b-69952ad5b50a
Commits
Reviewing files that changed from the base of the PR and between 5d63501 and d32f057.
Files selected for processing: 4
src/cell.cpp
src/geometry.cpp
src/random_ray/random_ray.cpp
tests/unit_tests/test_slice_data.py
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
This branch has not been deployed
No deployments
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
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
Currently, a slice plot can segfault when a lattice has no outer universe and its containing cell extends beyond the lattice. The geometry lookup marks the state as lost but then tries to continue without a valid lower-level universe index.
Minimal working example
To enable plotting to work in this case, this PR changes the geometry search to return
falsebefore descending when a point lies outside a lattice with no outer universe.AI Assistance
Checklist
I have made corresponding changes to the documentation (if applicable)Summary by CodeRabbit