Repository navigation
Draw a mesh variable of any degree on the mesh's own cells (#1057) - #1084
Merged
Merged
Conversation
meshVariable_to_native_pv_mesh handled only continuous P1; every other variable fell back to a Delaunay of its nodes, whose alpha filter drops the coarse cells of a graded mesh. It now subdivides each cell through the variable's nodes on the degree-k reference lattice: k^2 sub-triangles or sub-quads, k^3 sub-tetrahedra (Freudenthal) or sub-hexahedra, with point i still the variable's DOF i. The cell-to-DOF map is topological. The DOFs on each vertex, edge, face and cell interior come from the variable's own section through the DMPlex closure, and each closure entity is matched to a lattice entity by its corner set. Position only orders the several nodes of one entity, which follow that entity's orientation, against candidates a lattice spacing apart, so nodes off the chord still map correctly. Discontinuous variables keep the Delaunay fallback; test_0846's continuous-P2 case, which pinned that fallback, is replaced by a DG1 case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
H1's review of 23f00d5. F1: on a surface in 3D (a SphericalManifold) the points kept only their first two coordinates, and sub-cells were left unoriented, so at k >= 2 a quarter or more of them faced against their parent. The points now carry every coordinate, and each sub-cell is turned to face the way its parent cell does. A SphericalManifold test checks both at P1-P3. F3: VTK's 2D cell areas are unsigned, so removing the planar orientation passed every 2D test. The 2D checks now assert positive signed areas computed in numpy, and the tautological polynomial check is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #1057.
What changed and why
meshVariable_to_native_pv_meshdrew only continuous P1 natively. Every other variable fell back to a Delaunay of its nodes, whose alpha filter drops coarse cells on a graded mesh: 361 of 11610 cells were lost at 8:1. Saved refined runs reloaded with #690's fix (#1063) are exactly the meshes we want to look at in house.Native drawing. A continuous Lagrange variable of any degree k is now drawn on the mesh's own cells, each subdivided through the variable's nodes:
Point i is still DOF i, so the documented
pvm.point_data["T"] = T.data[:, 0]pattern is unchanged. Surfaces in 3D (SphericalManifold) keep all three coordinates, and each sub-cell faces the way its parent does.The map is topological (
_lagrange_subcell_connectivity):_basis_coordinate_dm), gives the DOFs on each vertex, edge, face and interior.None, and the caller falls back. That is safe but sometimes too strict: see Native higher-order rendering refuses valid high-aspect and k>=4 cells, and falls back to Delaunay silently (follow-up to #1057) #1083.Discontinuous variables keep the Delaunay fallback.
Changes worth noting:
meshVariable_to_pv_mesh_objectnow returns anUnstructuredGridrather than aPolyDatafor continuous k ≥ 2. No in-repo caller depends on the type.test_0846's continuous-P2 case pinned the old Delaunay route. It is replaced by a DG1 case.uw-visualisationskill and guide are updated.Tests (fail on development, pass here)
tests/test_1057_native_vis_higher_order.py(30 cases). Meshes: simplex box at refinement 0 and 1, annulus at refinement 0 and 1, a graded moved mesh, quads, hexes, tets (P1–P3), and a SphericalManifold. It checks:On development, 18 of the original 27 cases fail.
tests/parallel/test_1057_native_vis_parallel.pychecks ghost DOFs at np 2 and 4. On development, 4 of 6 cases fail.Mutation checks:
Existing visualisation tests: 148 passed (0055, 0800, 0846×2, 0847, 0848, 0850×2, 1100).
Timing: P2 on 92k triangles takes 0.6 s, and P2 on 37k tets takes 0.8 s.
Review
H1 reviewed 23f00d5 adversarially and approved it after two changes. Its oracle covered 43 configurations, 31 curved or split configurations and 231 perturbed trials, with no wrong connectivity. Both blocking findings are addressed in 5a9606d:
The tolerance finding, F2, is #1083. F4 predates this PR: a rank with no cells raises in
meshVariable_to_pv_mesh_object. H1's own record is to follow from H1.Checklist (UW3 Style Charter)
level_*andtier_*markers (S8).array/mesh.X.coords(S7)pixi.toml/pixi.lockor other dependency changesUnderworld development team with AI support from Claude Code