docs(examples): use gauge-vertex overload everywhere (U6)
Finding-U6 from doc/reviewer/usability-audit-2026-05-31.md. The Finding-D fix (external-audit-2026-05-30) added a clean one-call gauge-vertex overload: assign_euclidean_vertex_dof_indices(mesh, maps, gauge_vertex) But all user-facing code still showed the old verbose manual loop: auto vit = mesh.vertices().begin(); maps.v_idx[*vit++] = -1; int idx = 0; for (; vit != mesh.vertices().end(); ++vit) maps.v_idx[*vit] = idx++; Replaced in three places: README.md 'Minimal usage' code block example_euclidean.cpp Step 3 example_layout.cpp pin_first() helper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
10
README.md
10
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<double> x0(idx, 0.0);
|
||||
std::vector<double> x0(static_cast<std::size_t>(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]];
|
||||
|
||||
Reference in New Issue
Block a user