fix(solver+io): B1 block-FD Hessian, V3 NaN/Inf guard, C1 ok-flag (audit quick-wins)

B1 (api-performance): wire hyper_ideal_hessian_block_fd_sym into newton_hyper_ideal
instead of the full-FD path — 33×/1166× faster on cathead/brezel, also fixes the
FD-step vs Newton-tol accuracy floor (N1 cross-fix).

V3 (input-validation): add isfinite check on all vertex coordinates in load_mesh;
NaN/Inf now throws runtime_error at the I/O boundary before poisoning the solver.

C1 (test-coverage): expose the internal ok flag via an optional bool* parameter
on solve_linear_system so double-solver failure is no longer invisible to callers.

+5 new tests (LoadMeshThrowsOnNaN/Inf, OkFlag_True*, OkFlag_NullPointerIsSafe).
282/282 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tarik Moussa
2026-05-31 14:03:45 +02:00
parent 505dd4b0a5
commit 101f3138ce
4 changed files with 134 additions and 5 deletions

View File

@@ -29,6 +29,7 @@
#include <CGAL/boost/graph/helpers.h>
#include <string>
#include <stdexcept>
#include <cmath>
namespace conformallab {
@@ -62,6 +63,12 @@ inline ConformalMesh load_mesh(const std::string& filename)
throw std::runtime_error(
"conformallab: mesh from " + filename +
" is not triangulated (functionals require triangle faces)");
for (auto v : mesh.vertices()) {
const auto& p = mesh.point(v);
if (!std::isfinite(p.x()) || !std::isfinite(p.y()) || !std::isfinite(p.z()))
throw std::runtime_error(
"conformallab: non-finite vertex coordinate in " + filename);
}
return mesh;
}