Skip to content

Preserve face order across an Exodus round trip - #1913

Draft
cmdupuis3 wants to merge 1 commit into
mainfrom
cmd/exodus_elem_num_map
Draft

cmdupuis3 wants to merge 1 commit into
mainfrom
cmd/exodus_elem_num_map

Conversation

@cmdupuis3

@cmdupuis3 cmdupuis3 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1910

Overview

Exodus element blocks are homogeneous, so _encode_exodus regroups a mixed mesh by face size. Nothing recorded that permutation, so the mesh reloaded reordered -- intact, but with any face-centered data now describing the wrong faces, and no error to say so.

Carry each face's original position through the regrouping and write it to elem_num_map, then undo the permutation on read. Exodus defines elem_num_map as a user-facing element ID rather than a position, so the reader only honors it on files this writer produced, identified via qa_records, and only when the IDs form a genuine permutation.

This restores the exact-order assertions in test_mixed_exodus and test_grid_ugrid_exodus_roundtrip that the previous commit had to relax.

PR Checklist

General

  • An issue is created and linked
  • Added appropriate labels (if your uxarray repo permissions allow it)
  • Filled out Overview and Expected Usage (if applicable) sections

Testing & Benchmarking

  • There is adequate test coverage of changes from this PR (add new tests if needed)
  • If this PR could affect performance, ran ASV benchmarks and confirmed they show expected behavior (add a new benchmark if necessary)

Documentation and Examples

  • Docstrings updated with any function changes, and included in all new functions
  • User (public) functions added to docs/api.rst; internal (private) function names start with an underscore (_)

AI Disclosure

AI Usage: Claude Opus 5.5

  • I have tested and take responsibility for all AI-generated content in my PR.

Exodus element blocks are homogeneous, so `_encode_exodus` regroups a mixed
mesh by face size. Nothing recorded that permutation, so the mesh reloaded
reordered -- intact, but with any face-centered data now describing the
wrong faces, and no error to say so.

Carry each face's original position through the regrouping and write it to
`elem_num_map`, then undo the permutation on read. Exodus defines
`elem_num_map` as a user-facing element ID rather than a position, so the
reader only honors it on files this writer produced, identified via
`qa_records`, and only when the IDs form a genuine permutation.

This restores the exact-order assertions in `test_mixed_exodus` and
`test_grid_ugrid_exodus_roundtrip` that the previous commit had to relax.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cmdupuis3 cmdupuis3 self-assigned this Nov 20, 2026
@cmdupuis3 cmdupuis3 added bug Something isn't working accuracy Related to mathematical accuracy of operations, such as numerical precision or rounding errors labels Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accuracy Related to mathematical accuracy of operations, such as numerical precision or rounding errors bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exodus encode reorders faces without writing an element map

1 participant