diff --git a/README.md b/README.md index 53535b3..7161007 100644 --- a/README.md +++ b/README.md @@ -109,14 +109,12 @@ ConformalMesh mesh = load_mesh("input.off"); EuclideanMaps maps = setup_euclidean_maps(mesh); compute_euclidean_lambda0_from_mesh(mesh, maps); -// Assign DOFs — pin first vertex (gauge fix) -auto vit = mesh.vertices().begin(); -maps.v_idx[*vit++] = -1; -int idx = 0; -for (; vit != mesh.vertices().end(); ++vit) maps.v_idx[*vit] = idx++; +// Assign DOFs — pin first vertex as gauge fix, index the rest 0..n-1 +auto gauge = *mesh.vertices().begin(); +int n = assign_euclidean_vertex_dof_indices(mesh, maps, gauge); // Natural equilibrium target: x* = 0 by construction -std::vector x0(idx, 0.0); +std::vector x0(static_cast(n), 0.0); auto G0 = euclidean_gradient(mesh, x0, maps); for (auto v : mesh.vertices()) if (maps.v_idx[v] >= 0) maps.theta_v[v] -= G0[maps.v_idx[v]]; diff --git a/code/examples/example_euclidean.cpp b/code/examples/example_euclidean.cpp index fe79ad6..37c282d 100644 --- a/code/examples/example_euclidean.cpp +++ b/code/examples/example_euclidean.cpp @@ -59,13 +59,10 @@ int main(int argc, char* argv[]) compute_euclidean_lambda0_from_mesh(mesh, maps); // ── Step 3: pin the first vertex (gauge fix) ────────────────────────── - auto vit = mesh.vertices().begin(); - Vertex_index v_pinned = *vit++; - maps.v_idx[v_pinned] = -1; // pinned: u[v_pinned] = 0 (fixed) - int idx = 0; - for (; vit != mesh.vertices().end(); ++vit) - maps.v_idx[*vit] = idx++; - const int n = idx; + // The gauge-vertex overload pins the chosen vertex (v_idx = -1) and + // assigns sequential indices 0..n-1 to the rest in a single call. + Vertex_index v_pinned = *mesh.vertices().begin(); + const int n = assign_euclidean_vertex_dof_indices(mesh, maps, v_pinned); std::cout << "[example_euclidean] DOFs: " << n << " (1 vertex pinned).\n"; diff --git a/code/examples/example_layout.cpp b/code/examples/example_layout.cpp index da419b1..65abc96 100644 --- a/code/examples/example_layout.cpp +++ b/code/examples/example_layout.cpp @@ -54,14 +54,13 @@ static void set_natural_theta(ConformalMesh& mesh, EuclideanMaps& maps, int n) } // ── Helper: pin vertex 0, assign DOF indices 0..n-1 to the rest ────────────── +// Uses the gauge-vertex overload introduced in external-audit Finding-D: +// assign_euclidean_vertex_dof_indices(mesh, maps, gauge) pins the chosen +// vertex and assigns sequential indices in a single pass. static int pin_first(ConformalMesh& mesh, EuclideanMaps& maps) { - auto vit = mesh.vertices().begin(); - maps.v_idx[*vit++] = -1; // pinned - int idx = 0; - for (; vit != mesh.vertices().end(); ++vit) - maps.v_idx[*vit] = idx++; - return idx; + return assign_euclidean_vertex_dof_indices( + mesh, maps, *mesh.vertices().begin()); } // ── Main ───────────────────────────────────────────────────────────────────── diff --git a/doc/reviewer/usability-audit-2026-05-31.md b/doc/reviewer/usability-audit-2026-05-31.md index 20658ea..2840ef6 100644 --- a/doc/reviewer/usability-audit-2026-05-31.md +++ b/doc/reviewer/usability-audit-2026-05-31.md @@ -541,7 +541,7 @@ exposed via the CGAL public API, but a CLI user cannot reach them. | U3 | `contracts.md:16` | Doc error | 🟡 Medium | ✅ Fixed 2026-05-31 | | U4 | `README.md:17` | Stale | 🟡 Medium | ✅ Fixed 2026-05-31 | | U5 | `Discrete_conformal_map.h:14` | Stale | 🟡 Medium | ✅ Fixed 2026-05-31 | -| U6 | README + 2 examples | Stale | 🟡 Medium | 🟡 Open | +| U6 | README + 2 examples | Stale | 🟡 Medium | ✅ Fixed 2026-05-31 | | U7 | `getting-started.md` | Missing | 🟠 Minor | ✅ Fixed 2026-05-31 | | U8 | `README.md` | Missing | 🟠 Minor | ✅ Fixed 2026-05-31 | | U9 | `layout.hpp` + example | Missing | 🟠 Minor | 🟡 Open |