-
Notifications
You must be signed in to change notification settings - Fork 96
Enrichment of sparse-solvers, improved Multi-grid support (incl. hierarchical splines) #839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stable
Are you sure you want to change the base?
Conversation
|
I think that the multiple constructors are not needed, the should be only one with gsFunctionSet |
filiatra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the multiple constructors are not needed, the should be only one with gsFunctionSet
This accepts all other objects.
Also it would be nice to avoid the new inclusion of gsBoxTopology (maybe just move the function body to cpp file.
|
Do you think that the changes to the GaussSeidel preconditiner are necessary? After template instanciation, the compiler only sees for example which immediately simplifies to I do not see the need for any enable_if magic. For newer compilers a constexpr-if would be feasible |
Revert Gauss Seidel enable_if's Replace gsMappedBasis specialization in gsFeSpace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the sparse solver framework with custom preconditioners and significantly improves multi-grid support for hierarchical splines. The changes enable users to integrate Gismo preconditioners with Eigen's iterative solvers and provide comprehensive grid hierarchy construction methods for hierarchical tensor B-spline bases.
Key changes:
- Added
gsPreconditionerWrapperto bridge Gismo preconditioners with Eigen iterative solvers, enabling custom preconditioners in CG and BiCGSTAB - Implemented hierarchical coarsening methods for
gsGridHierarchythat work withgsHTensorBasis, including newbuildByHierarchicalCoarseningfunctionality - Extended
gsHTensorBasiswith level-based refinement/unrefinement methods (refineToLevel,unrefineToLevel, etc.) and changed transfer matrices toRowMajorformat for multi-grid compatibility
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 26 comments.
Show a summary per file
| File | Description |
|---|---|
src/gsSolver/gsPreconditioner.h |
Introduces gsPreconditionerWrapper class to adapt Gismo preconditioners for Eigen solvers |
src/gsMultiGrid/gsGridHierarchy.hpp |
Implements new grid hierarchy building methods with boundary conditions and hierarchical coarsening support |
src/gsMultiGrid/gsGridHierarchy.h |
Declares new overloads for grid hierarchy construction with component and BC parameters |
src/gsMatrix/gsSparseSolver.h |
Adds CGCustom and BiCGSTABCustom solver types and solveWithGuess interface for iterative solvers |
src/gsIO/gsXml*.cpp/hpp/h |
Extends XML serialization to support both RowMajor and ColMajor sparse matrices via template parameters |
src/gsHSplines/gsTHBSpline.hpp |
Updates transfer matrix type to RowMajor for consistency |
src/gsHSplines/gsHTensorBasis.hpp |
Implements level-based refinement/unrefinement methods and updates transfer matrix types to RowMajor |
src/gsHSplines/gsHTensorBasis.h |
Declares new refinement/unrefinement methods with transfer and coefficient update variants |
src/gsExpressions/gsFeSpace.h |
Refactors mapper initialization to use new gsDofMapper constructors, simplifying BC handling |
src/gsCore/gsMultiBasis.hpp |
Updates combineTransferMatrices to handle multiple components and adds assertions for validation |
src/gsCore/gsMultiBasis.h |
Extends getMapper methods with component count parameters and comprehensive documentation |
src/gsCore/gsLinearAlgebra.h |
Defines CGCustom and BiCGSTABCustom types in Eigen adaptor |
src/gsCore/gsForwardDeclarations.h |
Adds forward declaration for gsPreconditionerWrapper |
src/gsCore/gsDofMapper*.cpp/hpp/h |
Refactors with new constructors supporting topology, boundary conditions, and components; adds helper methods |
examples/sparseSolvers_example.cpp |
Demonstrates usage of custom preconditioner with CG solver |
examples/linearSolvers_example.cpp |
Adds example using custom Gismo preconditioner with Eigen CG solver |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/gsCore/gsDofMapper.h
Outdated
| GISMO_DEPRECATED | ||
| template<class T> | ||
| gsDofMapper( | ||
| const gsMultiBasis<T> &bases, | ||
| const gsFunctionSet<T> &bases, | ||
| const gsBoundaryConditions<T> &dirichlet, | ||
| int unk = 0 | ||
| ) : m_shift(0), m_bshift(0) | ||
| { | ||
| init(bases, dirichlet, unk); //obsolete, one component | ||
| init(bases, dirichlet, unk); //obsolete, one component | ||
| } |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GISMO_DEPRECATED macro is applied to a constructor that takes gsFunctionSet instead of gsMultiBasis. However, the newer constructors below also take gsFunctionSet or gsMultiBasis. This deprecation seems inconsistent with the new API design where gsFunctionSet is the more general base class. The deprecation should either be removed or the reasoning should be clarified in a comment.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Improved support for preconditioners and multigrid:
gsSparseSolver<>::CGCustom, which is an Eigen iterative solver of which we can set the preconditioner from agsPreconditioner. It is implemented via thegsPreconditionerWrapper, which wraps agsPreconditionerinto a format supported by Eigen.solveWithGuessinterface to Eigen'sIterativeSolverBasesolversgsGridHierarchymethods for hierarchical splinesgsHSplinesaRowMajorby default. This is the format which is also used inside the grid hierarchy for Multi-Grid.RowMajorsparse matricesNEW:
Hierarchical spline support in
gsGridHierarchy.Add
refineToLevel,refineCoarsestLevel,unrefineToLevelandunrefineFinestLeveltogsHTensorBasisIMPROVED:
Template specialization for Gauss-Seidel preconditioner
Add more constructors to
gsDofMapper, and make all mapper methods ingsMultiBasisandgsFeSpaceuse these constructorsyou'd like us to include them?