refactor(api-naming): A1–A3 standardize internal function names across functionals

A1: assign_*_dof_indices → assign_<geom>_<scope>_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_<geom> 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 <noreply@anthropic.com>
This commit is contained in:
Tarik Moussa
2026-05-31 14:48:13 +02:00
parent 30a132de60
commit 45f76e6496
2 changed files with 57 additions and 7 deletions

View File

@@ -105,7 +105,7 @@ inline int hyper_ideal_dimension(const ConformalMesh& mesh, const HyperIdealMaps
/// rotational mode for an all-hyper-ideal configuration). /// rotational mode for an all-hyper-ideal configuration).
/// ///
/// \returns total DOF count = `num_vertices(mesh) + num_edges(mesh)`. /// \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; int idx = 0;
for (auto v : mesh.vertices()) m.v_idx[v] = idx++; 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 /// 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`. /// DOF. Defaults `eps = 1e-5`, `tol = 1e-4` match the Java `FunctionalTest`.
inline bool gradient_check( inline bool gradient_check_hyper_ideal(
ConformalMesh& mesh, ConformalMesh& mesh,
const std::vector<double>& x0, const std::vector<double>& x0,
const HyperIdealMaps& m, const HyperIdealMaps& m,
@@ -501,4 +501,25 @@ inline bool gradient_check(
return ok; return ok;
} }
// ── Deprecated aliases (A1, A3 standardization) ────────────────────────────
// Use the standardized names assign_<geom>_<scope>_dof_indices and
// gradient_check_<geom> 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<double>& x0,
const HyperIdealMaps& m,
double eps = 1e-5,
double tol = 1e-4)
{
return gradient_check_hyper_ideal(mesh, x0, m, eps, tol);
}
} // namespace conformallab } // namespace conformallab

View File

@@ -97,7 +97,7 @@ inline SphericalMaps setup_spherical_maps(ConformalMesh& mesh)
/// ///
/// On closed spherical surfaces exactly one gauge vertex must be pinned /// On closed spherical surfaces exactly one gauge vertex must be pinned
/// to remove the global-scale null mode. /// 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; int idx = 0;
for (auto v : mesh.vertices()) m.v_idx[v] = idx++; for (auto v : mesh.vertices()) m.v_idx[v] = idx++;
@@ -109,7 +109,7 @@ inline int assign_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m)
/// surfaces to fix the global-scale gauge mode in a single call. /// surfaces to fix the global-scale gauge mode in a single call.
/// ///
/// \returns The number of free DOFs assigned (`num_vertices 1`). /// \returns The number of free DOFs assigned (`num_vertices 1`).
inline int assign_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m, inline int assign_spherical_vertex_dof_indices(ConformalMesh& mesh, SphericalMaps& m,
Vertex_index gauge) Vertex_index gauge)
{ {
int idx = 0; int idx = 0;
@@ -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, /// Assign DOF indices for all vertices AND all edges (vertex-DOFs first,
/// then edge-DOFs). Mirrors `assign_euclidean_all_dof_indices` for the /// then edge-DOFs). Mirrors `assign_euclidean_all_dof_indices` for the
/// cyclic spherical formulation. /// 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; int idx = 0;
for (auto v : mesh.vertices()) m.v_idx[v] = idx++; 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 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`). /// \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()) { for (auto e : mesh.edges()) {
auto h = mesh.halfedge(e); auto h = mesh.halfedge(e);
@@ -519,4 +519,33 @@ inline void apply_spherical_gauge(
} }
} }
// ── Deprecated aliases (A1A2 standardization) ────────────────────────────
// Use the standardized names assign_<geom>_<scope>_dof_indices and
// compute_<geom>_*_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 } // namespace conformallab