refactor(api): consistent naming for spherical + hyper-ideal helpers (A1–A3)
All checks were successful
C++ Tests / test-fast (pull_request) Successful in 2m20s
C++ Tests / quality-gates (pull_request) Has been skipped
C++ Tests / test-cgal (pull_request) Has been skipped

Standardize the low-level free-function API on <verb>_<geom>_<rest>,
matching the already-consistent setup_<geom>_maps. Old names kept as
[[deprecated]] inline aliases for one release; all internal call sites
migrated.

Renames:
  assign_vertex_dof_indices      -> assign_spherical_vertex_dof_indices
  assign_all_spherical_dof_indices -> assign_spherical_all_dof_indices
  assign_all_dof_indices         -> assign_hyper_ideal_all_dof_indices
  compute_lambda0_from_mesh      -> compute_spherical_lambda0_from_mesh
  gradient_check                 -> gradient_check_hyper_ideal

A4/A5 (public CGAL API) intentionally deferred pending the license/
provenance decision (see CGAL submission audit G0/G1).

Verified: 277/277 CGAL tests pass, no deprecation warnings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tarik Moussa
2026-05-31 09:15:22 +02:00
parent e13e7ea8e7
commit 65fc8ac816
16 changed files with 127 additions and 90 deletions

View File

@@ -52,8 +52,8 @@ TEST(SphericalFunctional, GradientCheck_Hessian)
{
auto mesh = make_spherical_tetrahedron();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_vertex_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_vertex_dof_indices(mesh, maps);
std::vector<double> x(static_cast<std::size_t>(n), -0.2);
@@ -122,8 +122,8 @@ TEST(SphericalFunctional, GradientCheck_OctaFaceVertex)
{
auto mesh = make_octahedron_face();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_vertex_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_vertex_dof_indices(mesh, maps);
// Small uniform conformal factor: shrink the triangle slightly.
std::vector<double> x(static_cast<std::size_t>(n), -0.3);
@@ -143,8 +143,8 @@ TEST(SphericalFunctional, GradientCheck_SpherTetVertex)
{
auto mesh = make_spherical_tetrahedron();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_vertex_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_vertex_dof_indices(mesh, maps);
std::vector<double> x(static_cast<std::size_t>(n), -0.2);
@@ -163,8 +163,8 @@ TEST(SphericalFunctional, GradientCheck_SpherTetAllDofs)
{
auto mesh = make_spherical_tetrahedron();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_all_spherical_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_all_dof_indices(mesh, maps);
// Replacement parameterization (Finding 3): when an edge carries a DOF its
// value *replaces* λ°_ij + u_i + u_j entirely, so Λ_ij = λ_e. Here the edge
@@ -208,8 +208,8 @@ TEST(SphericalFunctional, EdgeGradient_RegularTetClosedForm)
auto mesh = make_spherical_tetrahedron();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_all_spherical_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_all_dof_indices(mesh, maps);
// Edge DOF = λ⁰ → Λ_ij = λ⁰ → reproduces the arccos(1/3) tetrahedron.
// Vertex DOFs stay at 0 (ignored by the replacement convention for DOF edges).
@@ -245,8 +245,8 @@ TEST(SphericalFunctional, AnglesFiniteAtKnownPoint)
{
auto mesh = make_spherical_tetrahedron();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_vertex_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_vertex_dof_indices(mesh, maps);
// u_i = -1.5: contracts the triangle heavily but stays non-degenerate.
std::vector<double> x(static_cast<std::size_t>(n), -1.5);
@@ -287,8 +287,8 @@ TEST(SphericalFunctional, GradientCheck_SpherFan4Vertex)
mesh.add_face(center, rim[i], rim[(i + 1) % n_rim]);
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int ndof = assign_vertex_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int ndof = assign_spherical_vertex_dof_indices(mesh, maps);
std::vector<double> x(static_cast<std::size_t>(ndof), -0.3);
@@ -307,7 +307,7 @@ TEST(SphericalFunctional, GradientCheck_MixedPinnedVertices)
{
auto mesh = make_octahedron_face();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
// Pin v0, make v1 and v2 variable.
auto vit = mesh.vertices().begin();
@@ -340,8 +340,8 @@ TEST(SphericalFunctional, GaugeFix_SpherTetVertexZerosSumGv)
{
auto mesh = make_spherical_tetrahedron();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_vertex_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_vertex_dof_indices(mesh, maps);
// Off-gauge starting point: all u_i = -0.5
std::vector<double> x(static_cast<std::size_t>(n), -0.5);
@@ -384,8 +384,8 @@ TEST(SphericalFunctional, GaugeFix_ApplyInPlace)
{
auto mesh = make_spherical_tetrahedron();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_vertex_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_vertex_dof_indices(mesh, maps);
// x = -0.3: compressed but inside the valid spherical domain.
std::vector<double> x(static_cast<std::size_t>(n), -0.3);
@@ -409,8 +409,8 @@ TEST(SphericalFunctional, GaugeFix_AlreadyAtGaugeReturnsTNearZero)
// at the gauge maximum (by symmetry, ΣG_v = 0).
auto mesh = make_spherical_tetrahedron();
auto maps = setup_spherical_maps(mesh);
compute_lambda0_from_mesh(mesh, maps);
int n = assign_vertex_dof_indices(mesh, maps);
compute_spherical_lambda0_from_mesh(mesh, maps);
int n = assign_spherical_vertex_dof_indices(mesh, maps);
std::vector<double> x(static_cast<std::size_t>(n), 0.0);
double t = spherical_gauge_shift(mesh, x, maps);
@@ -489,7 +489,7 @@ TEST(SphericalGoldenJava, AngleBetaEnergyFromLengths)
// Setup parity (UnwrapUtility.prepareInvariantDataHyperbolicAndSpherical, scale):
// closed mesh, ALL 4 vertices variable, Θ_v = 2π, no edge DOFs,
// λ°_e = 2·log(SCALE·|p_i p_j|) (Java uses chord length × scale, whereas the
// C++ compute_lambda0_from_mesh helper assumes unit-sphere vertices and uses
// C++ compute_spherical_lambda0_from_mesh helper assumes unit-sphere vertices and uses
// ARC length — so we set λ° directly here to match Java exactly),
// per-vertex u(P) = 0.10·X 0.07·Y + 0.13·Z, SCALE = 0.2.
//