2d surface measures - #57
Merged
drummerdoc merged 5 commits intoAug 11, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds robust 2D “surface measure” support to the isosurface → MEF → binMEF pipeline, enabling downstream tooling to compute and bin arc length in 2D (and preserving area in 3D) reliably.
Changes:
- Fixes
Vecconstructor declarations inTools/SDFGen/vec.hto use correct in-class constructor naming. - Updates
isosurfaceto compute the extracted iso-measure before surface-output clears element/node storage, and extends it to report length in 2D and area in 3D. - Extends
binMEFto support 2-node elements (2D contours) by binning segment arc length, adds dimensionality sanity checks, and improves load-balance reporting for 2D/3D.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Tools/SDFGen/vec.h | Corrects template class constructor declarations to standard C++ form. |
| Src/isosurface.cpp | Computes and reports iso-measure (2D length / 3D area) before surface-output memory reclamation. |
| Src/binMEF.cpp | Adds 2D MEF support by binning segment length, validates MEF dimensionality, and reports total binned elements consistently. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two cheap checks on the assembled surface, both added because a defect there is silent: it corrupts the reported measure by tens of percent while every element still looks individually plausible. Edge lengths: marching squares/cubes cuts one cell, so no edge can exceed the finest cell diagonal. Checked for the single segment in 2D and all three triangle edges in 3D, since a triangle can be badly shaped while its area looks unremarkable. Reports the count, the worst edge in cell diagonals and its endpoints, and states that the measure is unreliable. Tolerance via edge_length_tol (default 1.5). Periodic face images: after a correct periodic clip, each crossing of a periodic face leaves one node on each face at the same transverse position, so the two face node sets are images of each other. A dropped sliver, a duplicated piece, an inconsistently resolved saddle or a resolution mismatch across the seam all break that. Inactive until the clip exists -- no node lies on a face without it -- and it says so rather than passing silently. Motivated by a periodic 1600^2 case where the crossing between the last and first cell centres was interpolated from raw coordinates rather than the minimum image, placing a node mid-domain: segments of 65.8 mm and 14.1 mm where a cell is 0.05 mm, inflating the arc length by 45%, and 109% in the worst plotfile. It is intermittent across regrids, so a passing case proves nothing -- hence a run-time check rather than a test. Disable with check_surface=0.
d-montgomery
approved these changes
Aug 11, 2026
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.
Three fixes found while adding PeleLMeX as a simulation backend to the RWTH
combustion-model-validation-framework-openfoam, which needs 2D flame-surfacemeasures from
isosurfaceandbinMEF.