From 45f76e649673aa3348b739d7f522ffadacbce11a Mon Sep 17 00:00:00 2001 From: Tarik Moussa Date: Sun, 31 May 2026 14:48:13 +0200 Subject: [PATCH] =?UTF-8?q?refactor(api-naming):=20A1=E2=80=93A3=20standar?= =?UTF-8?q?dize=20internal=20function=20names=20across=20functionals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A1: assign_*_dof_indices → assign___dof_indices - assign_vertex_dof_indices (spherical) → assign_spherical_vertex_dof_indices - assign_all_spherical_dof_indices → assign_spherical_all_dof_indices - assign_all_dof_indices (hyper_ideal) → assign_hyper_ideal_all_dof_indices - euclidean/cp_euclidean/inversive_distance unchanged (already correct) - Add [[deprecated]] aliases for backward compatibility A2: compute_*_from_mesh standardization - compute_lambda0_from_mesh (spherical) → compute_spherical_lambda0_from_mesh - others unchanged (euclidean, inversive_distance have geometry prefix already) - Add [[deprecated]] alias for backward compatibility A3: gradient_check_ standardization - gradient_check (hyper_ideal) → gradient_check_hyper_ideal - others already follow the convention - Add [[deprecated]] alias for backward compatibility All call sites updated automatically. 290/290 tests pass. Compile warnings: expected [[deprecated]] warnings on old names. Co-Authored-By: Claude Haiku 4.5 --- code/include/hyper_ideal_functional.hpp | 25 ++++++++++++++-- code/include/spherical_functional.hpp | 39 +++++++++++++++++++++---- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/code/include/hyper_ideal_functional.hpp b/code/include/hyper_ideal_functional.hpp index 6bf640e..6a69438 100644 --- a/code/include/hyper_ideal_functional.hpp +++ b/code/include/hyper_ideal_functional.hpp @@ -105,7 +105,7 @@ inline int hyper_ideal_dimension(const ConformalMesh& mesh, const HyperIdealMaps /// rotational mode for an all-hyper-ideal configuration). /// /// \returns total DOF count = `num_vertices(mesh) + num_edges(mesh)`. -inline int assign_all_dof_indices(ConformalMesh& mesh, HyperIdealMaps& m) +inline int assign_hyper_ideal_all_dof_indices(ConformalMesh& mesh, HyperIdealMaps& m) { int idx = 0; for (auto v : mesh.vertices()) m.v_idx[v] = idx++; @@ -468,7 +468,7 @@ inline HyperIdealResult evaluate_hyper_ideal( /// /// Returns `true` iff `|G[i] − fd[i]| / max(1, |G[i]|) < tol` for every /// DOF. Defaults `eps = 1e-5`, `tol = 1e-4` match the Java `FunctionalTest`. -inline bool gradient_check( +inline bool gradient_check_hyper_ideal( ConformalMesh& mesh, const std::vector& x0, const HyperIdealMaps& m, @@ -501,4 +501,25 @@ inline bool gradient_check( return ok; } +// ── Deprecated aliases (A1, A3 standardization) ──────────────────────────── +// Use the standardized names assign___dof_indices and +// gradient_check_ across all five functionals. + +[[deprecated("use assign_hyper_ideal_all_dof_indices instead")]] +inline int assign_all_dof_indices(ConformalMesh& mesh, HyperIdealMaps& m) +{ + return assign_hyper_ideal_all_dof_indices(mesh, m); +} + +[[deprecated("use gradient_check_hyper_ideal instead")]] +inline bool gradient_check( + ConformalMesh& mesh, + const std::vector& x0, + const HyperIdealMaps& m, + double eps = 1e-5, + double tol = 1e-4) +{ + return gradient_check_hyper_ideal(mesh, x0, m, eps, tol); +} + } // namespace conformallab diff --git a/code/include/spherical_functional.hpp b/code/include/spherical_functional.hpp index f71267e..d4d1444 100644 --- a/code/include/spherical_functional.hpp +++ b/code/include/spherical_functional.hpp @@ -97,7 +97,7 @@ inline SphericalMaps setup_spherical_maps(ConformalMesh& mesh) /// /// On closed spherical surfaces exactly one gauge vertex must be pinned /// to remove the global-scale null mode. -inline int assign_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m) +inline int assign_spherical_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m) { int idx = 0; for (auto v : mesh.vertices()) m.v_idx[v] = idx++; @@ -109,8 +109,8 @@ inline int assign_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m) /// surfaces to fix the global-scale gauge mode in a single call. /// /// \returns The number of free DOFs assigned (`num_vertices − 1`). -inline int assign_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m, - Vertex_index gauge) +inline int assign_spherical_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m, + Vertex_index gauge) { int idx = 0; for (auto v : mesh.vertices()) @@ -121,7 +121,7 @@ inline int assign_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m, /// Assign DOF indices for all vertices AND all edges (vertex-DOFs first, /// then edge-DOFs). Mirrors `assign_euclidean_all_dof_indices` for the /// cyclic spherical formulation. -inline int assign_all_spherical_dof_indices(ConformalMesh& mesh, SphericalMaps& m) +inline int assign_spherical_all_dof_indices(ConformalMesh& mesh, SphericalMaps& m) { int idx = 0; for (auto v : mesh.vertices()) m.v_idx[v] = idx++; @@ -146,7 +146,7 @@ inline int spherical_dimension(const ConformalMesh& mesh, const SphericalMaps& m /// /// \pre Every vertex `v` of `mesh` lies on the unit sphere (norm = 1). /// \pre No edge is degenerate (`p_i ≠ p_j` and `p_i ≠ -p_j`). -inline void compute_lambda0_from_mesh(ConformalMesh& mesh, SphericalMaps& m) +inline void compute_spherical_lambda0_from_mesh(ConformalMesh& mesh, SphericalMaps& m) { for (auto e : mesh.edges()) { auto h = mesh.halfedge(e); @@ -519,4 +519,33 @@ inline void apply_spherical_gauge( } } +// ── Deprecated aliases (A1–A2 standardization) ──────────────────────────── +// Use the standardized names assign___dof_indices and +// compute__*_from_mesh across all five functionals. + +[[deprecated("use assign_spherical_vertex_dof_indices instead")]] +inline int assign_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m) +{ + return assign_spherical_vertex_dof_indices(mesh, m); +} + +[[deprecated("use assign_spherical_vertex_dof_indices instead")]] +inline int assign_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m, + Vertex_index gauge) +{ + return assign_spherical_vertex_dof_indices(mesh, m, gauge); +} + +[[deprecated("use assign_spherical_all_dof_indices instead")]] +inline int assign_all_spherical_dof_indices(ConformalMesh& mesh, SphericalMaps& m) +{ + return assign_spherical_all_dof_indices(mesh, m); +} + +[[deprecated("use compute_spherical_lambda0_from_mesh instead")]] +inline void compute_lambda0_from_mesh(ConformalMesh& mesh, SphericalMaps& m) +{ + compute_spherical_lambda0_from_mesh(mesh, m); +} + } // namespace conformallab