Skip to content

Integration of BlockCatamari/MeshFEMSparse - #115

Open
jpanetta wants to merge 23 commits into
polyfem:mainfrom
MeshFEM:integrate
Open

Integration of BlockCatamari/MeshFEMSparse#115
jpanetta wants to merge 23 commits into
polyfem:mainfrom
MeshFEM:integrate

Conversation

@jpanetta

@jpanetta jpanetta commented Aug 8, 2026

Copy link
Copy Markdown

Integrate BlockCatamari solver and add support for BlockCSCHessian. Also support sharing linear solvers across descent strategies to avoid unnecessary symbolic factorization work.

The various supported symmetric matrix types are managed by the new Hessian variant class, which facilitates the conversions needed when the Problem and Solver work in different formats.

halehOssadat and others added 18 commits July 22, 2026 14:02
A typo in `spqr.cmake` prevented the `SuiteSparse::SPQR` from being
detected, leading to an unnecessary `find_package(SPQR)` call. This call
in turn can bring in a newer system-level SuiteSparse library that
conflicts with the older CPM version and breaks the configuration step.

We also add `include(suitesparse)` before checking the target in case
this was not done previously (i.e., if the other `SuiteSparse`
dependencies have been disabled).
… in a PolyFEM-compatible version of Metis in this case.

Metis is needed for orderings like cholmod_nested_dissection and
cholmod_metis (anything depending on the PARTITION module of CHOLMOD).
Newer versions of SuiteSparse package their own customized version of
Metis, but until we upgrade we need to bring it in ourselves.

Note that PolyFEM includes Metis via `wildmeshing-toolkit` and
configures it for 32-bit indices; we bring in the identical git commit
and apply matching configuration settings here.
…st-path) and sparsity-update-aware guarded symbolic factorization
…factorization.

This prevents strategy switches from causing unnecessary symbolic factorizations and
and losing track of adaptive ordering timing statistics.
It also requires moving the sparsity pattern ID metadata onto the linear
solver object.
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.58537% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.96%. Comparing base (e38cfac) to head (112acb9).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/polysolve/Hessian.hpp 70.73% 24 Missing ⚠️
src/polysolve/linear/CatamariSolver.cpp 61.90% 16 Missing ⚠️
.../polysolve/nonlinear/descent_strategies/Newton.cpp 85.36% 6 Missing ⚠️
src/polysolve/linear/Solver.hpp 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #115      +/-   ##
==========================================
- Coverage   80.73%   79.96%   -0.78%     
==========================================
  Files          51       54       +3     
  Lines        2118     2286     +168     
  Branches      280      311      +31     
==========================================
+ Hits         1710     1828     +118     
- Misses        408      458      +50     
Flag Coverage Δ
polysolve 79.96% <76.58%> (-0.78%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/polysolve/Hessian.hpp
// will both be of size `rows() - nfv`, where `nfv` is the number of
// unique indices in `fixedVars). This differs from MeshFEMSparse's
// convention of working with full-space RHS and solution vectors.
struct BCSCHessianWithFixedVars {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i prefer classes

throw std::runtime_error("Dense Hessian not implemented.");
}

virtual size_t getSparsityPatternID() const { return -1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an int in the linear part. Also, is it necessary to have it in the linear solver? things seems to be duplicated

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can change this to int, with a corresponding change to the PolyFEM PR.

And, yes, tracking pattern IDs in both places is necessary, and there is no actual duplication here. The idea is that the problem reports its current sparsity pattern ID while the linear solver gets tagged with the ID of the sparsity pattern it most recently analyzed. The analysis phase only needs to run when the IDs disagree (i.e., only when the sparsity pattern actually changes).

@teseoch teseoch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of coordination between linear and non-linear; is it necessary?

MeshFEM::CatamariFactorizer factorizer_;
Eigen::Index reduced_size_ = -1;
Eigen::Index full_size_ = -1;
bool symbolic_factorization_ = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this never become true

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, yes, I will fix this; it only affects what stats get collected by get_info.

@teseoch

teseoch commented Sep 2, 2026

Copy link
Copy Markdown
Member

can you add some test using the new matrix representation and the different conversions back and forth?

@jpanetta

jpanetta commented Sep 2, 2026

Copy link
Copy Markdown
Author

Regarding your question about excessive coordination--could you be more specific about the concern?

And yes, I can add unit tests for those conversions. There is some of this within the MeshFEMSparse unit tests, but I didn't add tests for the Hessian wrapper type itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants