Files
ConformalLabpp/code/tests/cgal/CMakeLists.txt
Tarik Moussa e70689d29f feat(phase4a+4b): Newton solver + CGAL mesh I/O
Phase 4a — newton_solver.hpp:
  - newton_euclidean(): SimplicialLDLT on H (PSD); solves H·Δx = −G
  - newton_spherical(): SimplicialLDLT on −H (NSD→PSD); solves (−H)·Δx = G
  - Backtracking line search (halving α up to 20×) for global convergence
  - NewtonResult struct: x, iterations, grad_inf_norm, converged
  - 7 tests: 4 spherical (convergence, few iters, large perturbation,
    field consistency) + 3 Euclidean (triangle pinned, quad pinned,
    mixed pinned — all with natural-theta equilibrium at x=0)

Phase 4b — mesh_io.hpp:
  - read_mesh() / write_mesh(): CGAL::IO::read/write_polygon_mesh wrappers
  - load_mesh() / save_mesh(): throwing convenience versions
  - Supports OFF, OBJ, PLY (format detected by file extension)
  - 6 tests: OFF round-trip (tet + quad), OBJ round-trip, missing-file throw,
    vertex-position preservation, save/load convenience wrappers

All 75 cgal tests pass (3 skipped as before).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-12 17:35:00 +02:00

62 lines
2.3 KiB
CMake

# tests/cgal/CMakeLists.txt
#
# CGAL-dependent test target. Only built when -DWITH_CGAL=ON.
# Requires Boost (find_package(Boost REQUIRED) is called in the root CMakeLists).
#
# Run with:
# cmake -S code -B build -DWITH_CGAL=ON
# cmake --build build --target conformallab_cgal_tests
# ctest --test-dir build -R cgal
add_executable(conformallab_cgal_tests
# ── Phase 3a: mesh infrastructure ──────────────────────────────────────
test_conformal_mesh.cpp
# ── Phase 3b: HyperIdealFunctional ─────────────────────────────────────
test_hyper_ideal_functional.cpp
# ── Phase 3c + 3e: SphericalFunctional + gauge-fix ────────────────────
test_spherical_functional.cpp
# ── Phase 3d: EuclideanCyclicFunctional ───────────────────────────────
test_euclidean_functional.cpp
# ── Phase 3f: Hessians (cotangent Laplacian, spherical + Euclidean) ───
test_euclidean_hessian.cpp
test_spherical_hessian.cpp
# ── Phase 4a: Newton solver ────────────────────────────────────────────
test_newton_solver.cpp
# ── Phase 4b: Mesh I/O (CGAL::IO) ─────────────────────────────────────
test_mesh_io.cpp
)
target_include_directories(conformallab_cgal_tests SYSTEM PRIVATE
${CMAKE_SOURCE_DIR}/deps/eigen-3.4.0
${CMAKE_SOURCE_DIR}/deps/CGAL-6.1.1/include
${Boost_INCLUDE_DIRS}
)
target_include_directories(conformallab_cgal_tests PRIVATE
${CMAKE_SOURCE_DIR}/include
)
target_compile_definitions(conformallab_cgal_tests PRIVATE
CGAL_DISABLE_GMP
CGAL_DISABLE_MPFR
)
# Suppress warnings from CGAL/Boost headers
target_compile_options(conformallab_cgal_tests PRIVATE
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wno-unused-parameter>
)
target_link_libraries(conformallab_cgal_tests PRIVATE GTest::gtest_main)
include(GoogleTest)
gtest_discover_tests(conformallab_cgal_tests
TEST_PREFIX "cgal."
DISCOVERY_TIMEOUT 60
)