63 typedef memory::shared_ptr<gsMultiGridOp>
Ptr;
66 typedef memory::unique_ptr<gsMultiGridOp>
uPtr;
100 std::vector<SpMatrixRowMajor> transferMatrices,
112 std::vector<SpMatrixRowMajorPtr> transferMatrices,
124 const std::vector<OpPtr>& ops,
125 const std::vector<OpPtr>& prolongation,
126 const std::vector<OpPtr>& restriction,
138 std::vector<SpMatrixRowMajor> transferMatrices,
151 std::vector<SpMatrixRowMajorPtr> transferMatrices,
164 const std::vector<OpPtr>& ops,
165 const std::vector<OpPtr>& prolongation,
166 const std::vector<OpPtr>& restriction,
173 void init(
SpMatrixPtr fineMatrix, std::vector<SpMatrixRowMajorPtr> transferMatrices);
226 const std::vector<Matrix>& rhs,
227 const std::vector<Matrix>& dirichletIntp,
237 const std::vector<Matrix>& rhs,
238 const std::vector<Matrix>& fixedValues,
264 GISMO_ASSERT ( lvl >= 0 && lvl <
m_nLevels,
"gsMultiGridOp: The given level "<<lvl<<
" is not feasible." );
399 #ifndef GISMO_BUILD_LIB
400 #include GISMO_HPP_HEADER(gsMultiGrid.hpp)
index_t finestLevel() const
The index of the finest level (0-based)
Definition: gsMultiGrid.h:259
void setNumPostSmooth(index_t n)
Set number of post-smoothing steps to perform.
Definition: gsMultiGrid.h:314
void setNumCycles(index_t n)
Definition: gsMultiGrid.h:328
static gsOptionList defaultOptions()
Returns a list of default options.
Definition: gsMultiGrid.hpp:300
std::vector< OpPtr > m_ops
Underlying operators (=stiffness matrix) on each level.
Definition: gsMultiGrid.h:366
T m_damping
Damping for the coarse-grid correction.
Definition: gsMultiGrid.h:393
index_t setNumPostSmooth() const
Get number of post-smoothing steps to perform.
Definition: gsMultiGrid.h:317
memory::unique_ptr< gsMultiGridOp > uPtr
Unique pointer for gsMultiGridOp.
Definition: gsMultiGrid.h:66
gsMultiGridOp(SpMatrix fineMatrix, std::vector< SpMatrixRowMajor > transferMatrices, OpPtr coarseSolver=OpPtr())
Constructor.
Definition: gsMultiGrid.hpp:20
std::vector< PrecondPtr > m_smoother
Smoothers on each level.
Definition: gsMultiGrid.h:369
PrecondPtr smoother(index_t lvl) const
Definition: gsMultiGrid.h:299
memory::shared_ptr< SpMatrixRowMajor > SpMatrixRowMajorPtr
Smart pointer to matrix type for transfers.
Definition: gsMultiGrid.h:90
gsPreconditionerOp< T >::Ptr PrecondPtr
Shared pointer to gsPreconditionerOp.
Definition: gsMultiGrid.h:72
void setNumPreSmooth(index_t n)
Set number of pre-smoothing steps to perform.
Definition: gsMultiGrid.h:308
static uPtr make(SpMatrix fineMatrix, std::vector< SpMatrixRowMajor > transferMatrices, OpPtr coarseSolver=OpPtr())
Make function returning smart pointer.
Definition: gsMultiGrid.h:136
OpPtr m_coarseSolver
Solver for the coarsest-grid problem.
Definition: gsMultiGrid.h:378
OpPtr underlyingOp(index_t lvl) const
Underlying operator (=stiffness matrix) for given level.
Definition: gsMultiGrid.h:269
index_t nDofs() const
Number of dofs for the finest level.
Definition: gsMultiGrid.h:284
void prolongVector(index_t lc, const Matrix &coarse, Matrix &fine) const
Prolong a vector of coefficients from the level lc, given by coarse, to the next finer level...
Definition: gsMultiGrid.hpp:275
index_t m_numPostSmooth
Number of post-smoothing steps.
Definition: gsMultiGrid.h:384
S give(S &x)
Definition: gsMemory.h:266
Simple abstract class for (discrete) linear preconditioners.
std::vector< OpPtr > m_restrict
Restriction matrix for each grid transition.
Definition: gsMultiGrid.h:375
index_t cols() const override
Returns the number of columns of the operator.
Definition: gsMultiGrid.h:290
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
T coarseGridCorrectionDamping() const
Get the damping of for the coarse-grid correction.
Definition: gsMultiGrid.h:352
void multiGridStep(index_t level, const Matrix &rhs, Matrix &x) const
Perform one multigrid cycle, starting from the given level.
Definition: gsMultiGrid.hpp:148
void setUnderlyingOp(index_t lvl, OpPtr op)
Set underlying operator (=stiffness matrix) for certain level.
Definition: gsMultiGrid.h:262
Provides a list of labeled parameters/options that can be set and accessed easily.
void setNumCycles(index_t lvl, index_t n)
Definition: gsMultiGrid.h:339
memory::shared_ptr< SpMatrix > SpMatrixPtr
Smart pointer to sparse matrix type.
Definition: gsMultiGrid.h:87
void cascadicMultiGrid(const std::vector< Matrix > &rhs, const std::vector< Matrix > &fixedValues, Matrix &result) const
Perform one cascadic multigrid cycle and store the resulting solution vector in result.
Definition: gsMultiGrid.hpp:235
memory::shared_ptr< gsMultiGridOp > Ptr
Shared pointer for gsMultiGridOp.
Definition: gsMultiGrid.h:63
memory::shared_ptr< gsLinearOperator > Ptr
Shared pointer for gsLinearOperator.
Definition: gsLinearOperator.h:33
void initCoarseSolver() const
Init solver on coarsest grid level.
Definition: gsMultiGrid.hpp:102
const SpMatrix & matrix() const
Stiffness matrix for finest level.
Definition: gsMultiGrid.h:278
void setSymmSmooth(bool s)
Definition: gsMultiGrid.h:321
void setOptions(const gsOptionList &opt) override
Set the options based on a gsOptionList.
Definition: gsMultiGrid.hpp:313
gsMatrix< T > Matrix
Matrix type.
Definition: gsMultiGrid.h:78
void restrictVector(index_t lf, const Matrix &fine, Matrix &coarse) const
Restrict a vector of coefficients from the level lf, given by fine, to the next coarser level...
Definition: gsMultiGrid.hpp:266
void stepT(const Matrix &rhs, Matrix &x) const override
Perform one transposed multigrid cycle.
Definition: gsMultiGrid.h:213
Provides forward declarations of types and structs.
bool m_symmSmooth
Symmmetric smoothing.
Definition: gsMultiGrid.h:387
void setCoarseSolver(const OpPtr &sol)
Set the solver for the coarsest problem (level 0)
Definition: gsMultiGrid.h:302
gsSparseMatrix< T, RowMajor > SpMatrixRowMajor
Matrix type for transfers.
Definition: gsMultiGrid.h:84
static uPtr make(const std::vector< OpPtr > &ops, const std::vector< OpPtr > &prolongation, const std::vector< OpPtr > &restriction, OpPtr coarseSolver=OpPtr())
Make function returning a shared pointer for a matix-free variant.
Definition: gsMultiGrid.h:163
index_t numLevels() const
Number of levels in the multigrid construction.
Definition: gsMultiGrid.h:256
gsSparseMatrix< T > SpMatrix
Sparse matrix type.
Definition: gsMultiGrid.h:81
void fullMultiGrid(const std::vector< Matrix > &rhs, const std::vector< Matrix > &dirichletIntp, Matrix &result) const
Perform one full multigrid cycle and store the resulting solution vector in result.
Definition: gsMultiGrid.hpp:204
OpPtr underlyingOp() const override
Underlying operator (=stiffness matrix) for finest level.
Definition: gsMultiGrid.h:272
Simple abstract class for perconditioners.
Definition: gsPreconditioner.h:42
void smoothingStep(const Matrix &rhs, Matrix &x) const
Apply smoothing steps on finest grid.
Definition: gsMultiGrid.h:189
void setCoarseGridCorrectionDamping(T damping)
Set the damping of for the coarse-grid correction.
Definition: gsMultiGrid.h:349
index_t numCycles(index_t lvl) const
Get number of coarse grid steps to be applied.
Definition: gsMultiGrid.h:346
index_t m_nLevels
Number of levels.
Definition: gsMultiGrid.h:363
void init(SpMatrixPtr fineMatrix, std::vector< SpMatrixRowMajorPtr > transferMatrices)
Init function that is used by matrix based constructors.
Definition: gsMultiGrid.hpp:70
gsVector< index_t > m_numCycles
Number of coarse-grid steps (1=V-cycle, 2=W-cycle)
Definition: gsMultiGrid.h:390
gsLinearOperator< T >::Ptr OpPtr
Shared pointer to gsLinearOperator.
Definition: gsMultiGrid.h:69
index_t nDofs(index_t lvl) const
Number of dofs for the given level.
Definition: gsMultiGrid.h:281
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
void smoothingStep(index_t level, const Matrix &rhs, Matrix &x) const
Apply smoothing steps on the corresponding level.
Definition: gsMultiGrid.hpp:125
std::vector< OpPtr > m_prolong
Prolongation matrix for each grid transition.
Definition: gsMultiGrid.h:372
gsPreconditionerOp< T > Base
Direct base class.
Definition: gsMultiGrid.h:75
void step(const Matrix &rhs, Matrix &x) const override
Perform one multigrid cycle.
Definition: gsMultiGrid.h:203
void solveCoarse(const Matrix &rhs, Matrix &result) const
Solve the problem with direct solver on coarsest level.
Definition: gsMultiGrid.h:249
static uPtr make(SpMatrixPtr fineMatrix, std::vector< SpMatrixRowMajorPtr > transferMatrices, OpPtr coarseSolver=OpPtr())
Make function returning smart pointer.
Definition: gsMultiGrid.h:149
index_t m_numPreSmooth
Number of pre-smoothing steps.
Definition: gsMultiGrid.h:381
bool symmSmooth() const
Get symmetric post-smoothing option.
Definition: gsMultiGrid.h:324
index_t setNumPreSmooth() const
Get number of pre-smoothing steps to perform.
Definition: gsMultiGrid.h:311
OpPtr coarseSolver() const
Get the solver for the coarsest problem (level 0)
Definition: gsMultiGrid.h:305
Multigrid preconditioner.
Definition: gsMultiGrid.h:57
void setSmoother(index_t lvl, const PrecondPtr &sm)
Definition: gsMultiGrid.hpp:284
index_t rows() const override
Returns the number of rows of the operator.
Definition: gsMultiGrid.h:287
memory::shared_ptr< gsPreconditionerOp > Ptr
Shared pointer for gsLinearOperator.
Definition: gsPreconditioner.h:47