Skip to content
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

Hexagonal Lattice Roundtrip #3003

Merged
merged 4 commits into from
May 25, 2024
Merged

Conversation

pshriwise
Copy link
Contributor

@pshriwise pshriwise commented May 14, 2024

Description

This fixes a bug described in #3002 where hexagonal lattices don't round trip in and out of XML correctly. A break condition in HexagonalLattice.from_xml_element was occurring before the index into the flat array of universe IDs is incremented, causing the next universe ID used for the second axial to be the last universe from the first layer. The universes in the resulting HexagonalLattice object are scrambled. This is a silent bug unless one of the universe IDs is omitted from the new lattice entirely in which case it's possible (but not guaranteed) that the abandoned universe will be read in later as part of the cell parsing and treated as the root universe of the geometry.

I've added a test to check that the universes of a multi-layer hex lattice are roundtripped correctly both: a) when the universes in each layer are the same and b) when the universes for each lattice cell are unique.

Fixes #3002

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)

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

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

Thanks for the fix and the nice test!

@paulromano paulromano enabled auto-merge (squash) May 24, 2024 22:56
@paulromano paulromano merged commit 12ecc17 into openmc-dev:develop May 25, 2024
17 checks passed
church89 pushed a commit to openmsr/openmc that referenced this pull request Jul 18, 2024
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
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.

Hexagonal Lattices Don't Roundtrip
2 participants