Repository navigation
Locator: an exact fallback finds the contained points the walk misses (#1183) - #1190
Conversation
…#1183) On #1123's sheared mesh the face-crossing walk, its restarts from the nearest centroids, and the face-tolerance search could all miss a point a local cell contains: 2 per million at np 2, some well inside their cell. A point the walk and its restarts do not place is now tested against every local cell whose bounding box holds it, through a uniform bin grid over the cells' boxes (built once, on first use). That search is complete, so a contained point is found; it is exact (the same barycentric test and ROUNDOFF guard); and it runs only for the points the walk missed, vectorised over (point, candidate) pairs. tests/parallel/test_1183_contained_points_owned_parallel.py: 1e6 points sampled in local cells (a quarter within 1e-9 of an entity); development loses 2 at np 2, this loses none at np 1, 2 and 4. Claims are unchanged on unsheared meshes at np 2 to 4. Serial evaluation of 1e6 mostly exterior points: 5.7 s against development's 6.1 s. Underworld development team with AI support from Claude Code
|
Parallel review of #1190 at 7ce22e0: READY. From H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)).
The PR's test (
That matches the body: development loses its two points at np 2 only. 1. Claims made by agreed ownership are unchanged.
2. The grid's size and memory (built on demand, serial; it is rank-local):
3. The grid is rebuilt when the mesh moves.
Not run:
Underworld development team with AI support from Claude Code |
…ew of #1190) The grid's bin size was the median cell box, so its bin count was (extent / median)^dim. On a mesh whose cells mostly sit in a thin band or a corner (refined toward a fault), that is 1e6 to 1e8 bins on every rank. The bin size is now scaled up until the count is at most the local cell count. Larger bins hold more candidates, but the search stays complete: the cap bounds the cost and never changes the answer. test_1183: a 3-D box with each axis mapping [0, 0.9] onto [0, 0.01] packs about 73 % of its cells into a corner; uncapped it would build 84,604,519 bins for 2,615 cells, capped 2,197. Every contained point is still found, at np 1, 2 and 4. Underworld development team with AI support from Claude Code
|
Re-check of #1190's bin cap (91a1224, in head 45bf6cf): READY. From H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)). The PR's
Underworld development team with AI support from Claude Code |
…fallback tested directly The sheared fixture was gmsh's box with #1123's shear and sine terms of amplitude 0.03. gmsh builds differ (1094 cells on macOS against 1086 on Linux), and on one macOS build a cell was turned over, so the locator tests had no right answer. tests/parallel/sheared_box_fixture.py (from #1213): a structured box of cubes split into six tetrahedra, independent of gmsh, with the sine amplitude at 0.025: the sine gradient's norm (2 pi 0.025 = 0.157) is below the linear shear's smallest singular value (0.175), so the map is invertible, and the fixture asserts, collectively, that no cell turned over. test_1123 (serial and parallel) and test_1183 use it. Regression power on it: before #1175, test_1123 fails at np 1, 2 and 4 (116 to 125 inside points classified exterior per distance; 392, 47 and 10 owned by no rank). #1183's 2 per million lived in near-degenerate cells of one gmsh build and no valid fixture reproduces them; test_1183 tests the fallback directly instead: with the walk forced to miss every point, the fallback must find them all, which before #1190 loses 1200 to 1427 of 2e4. Underworld development team with AI support from Claude Code
Fixes #1183.
The defect. On #1123's sheared 3-D mesh a few points that a rank's own cell contains were owned by no rank. The face-crossing walk, its restarts from the four nearest centroids, and the face-tolerance search over the 50 nearest centroids all missed them. H1's probe found 2 per million at np 2 (H1 is the parallel review desk), some well inside their cell (smallest barycentric coordinate 0.009). That mesh is valid: every cell keeps its orientation.
The fix. A point the walk and its restarts do not place is tested against every local cell whose bounding box holds it.
SimplexLocator.cells_containingbuilds a uniform bin grid over the local cells' bounding boxes, once, on first use, with the bin size the median box size. Each bin lists the cells whose box overlaps it.ROUNDOFFguard as the walk; ties go to the lowest cell in the entity's star, as before.Measured on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH).
H1's sample: 1e6 points sampled in local cells, a quarter within 1e-9 of a face, edge or vertex.
Claims: what each rank claims, on random points, vertices and points just off vertices in unsheared 2-D and 3-D boxes, is identical to development at np 2, 3 and 4.
Cost: serial
evaluateof 1e6 mostly exterior points in a 3-D box (the case H1 timed on Exact point location on simplex meshes: barycentric coordinates and a face-crossing walk (#1123, register row 14) #1175): 5.7 s against development's 6.1 s, at a machine load of about 20.Tests.
tests/parallel/test_1183_contained_points_owned_parallel.py, tier B, the sample above. Development fails at np 2 (2 lost); this branch passes at np 1, 2 and 4. It runs in batch 3 and under--p N. Also run:Not here: #1178, the seam claim, is a separate defect. This PR changes only whether a contained point is found by its own rank.
Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)
level_*andtier_*markers (S8)maybe_/try_/do_) and no commented-out code (S3, S4).array/mesh.X.coords— nowith ....access(...), nomesh.data(S7)pixi.toml/pixi.lockor other dependency changes riding in an unrelated PRUnderworld development team with AI support from Claude Code