Repository navigation
fix(loop-common): tetra boundary points, rotated local frames, bounded lookup memory - #415
Open
lachlangrose wants to merge 7 commits into
Open
lachlangrose wants to merge 7 commits into
lachlangrose wants to merge 7 commits into
Conversation
TetMesh and P2TetMesh used a strict test for the mesh extent, so a point on a boundary face gave NaN. Remove their own inside() so they use the grid test, which includes the boundary. position_to_cell_index already puts a point on the maximum face in the last cell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
create_support_from_bbox projected only the origin and maximum corners into the local frame. With a rotation this gave a flat support. Use BoundingBox.local_enclosure, which projects all corners, and remove the old comment that said no rotation is used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
get_element_for_location built (n, 5, 4, 3) arrays for all points at once, about 2.7 KB a point. Process the points in blocks of 1e4, the same block size as the unstructured tetra lookup. The results do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
P2TetMesh nsteps counts cells, so use nsteps=[4, 4, 4] to put the test points on the boundary. Remove an inside() call in the TetMesh block lookup whose result was not used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…points TetMesh and P2TetMesh now count points on the mesh boundary as inside. Only the inside and position_to_cell_index arrays of the two tetra meshes change (18 keys: unit, aniso and small cases). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…boundary TetMesh and P2TetMesh now keep points on the mesh boundary inside, so the P1 and DFI golden fields have finite values on the lower faces (631 values and 1893 gradient components that were NaN). Values that were finite before are unchanged. The strict xfail for finding F2 now passes, so the marker is removed. Golden files of the other engines are kept: they differ only by machine rounding, far below the test tolerance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A support built in a rotated local frame now covers the whole rotated box, but it reused the cell counts of the world box. The local box is longer than the world box on the rotated axes, so the cells became larger and stretched (for 30 degrees: 2.05 x 1.75 x 1.4 instead of about 1.4 on each axis). The PLI gradient error then grew 10 times and two diagnostics frame tests failed. Scale the cell count on each axis by the ratio of the local length to the world length, so each axis keeps the world cell size. An unrotated box has a ratio of 1 and keeps the same mesh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
CI fix notes:
🤖 Generated with Claude Code |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes three support problems found in a repo audit.
TetMeshandP2TetMeshused a strict</>inside test, so corners and max-face points were "outside". Example: on a 4³ mesh with a linear field, (0,0,0), (4,4,4) and (4,1.5,1.5) gave NaN, whereStructuredGridgives the right values. Both now use the inherited inclusiveinside(). Points on the max face map to the last cell. Points even 1e-12 outside are still outside.bounding_box.local_enclosure(). Unrotated boxes give bit-identical results.packages/loop_common/tests/data/structured_support_reference.npzis regenerated. Exactly 18 entries changed, all{TetMesh,P2TetMesh}/*/insideandposition_to_cell_index: the intended boundary change. No evaluation or geometry entry changed.Behaviour change for rotated boxes: the support covers the whole rotated extent with the same
nsteps, so cells are larger and are no longer cubes. Before, the support was degenerate.Tests: 95 passed in the touched loop_common test files. The review also ran test_world_location_consumers and test_frame_persistence: 241 passed. It checked boundary points against StructuredGrid on 30k points (max difference 1e-14), rotated frames with 3 support types, and chunked against unchunked lookup. Not run locally: the full loop_interpolation and LoopStructural suites; please rely on CI. Not changed:
P2TetMeshlookup still uses one full block.🤖 Generated with Claude Code