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)
memory::shared_ptr< gsLinearOperator > Ptr
Shared pointer for gsLinearOperator.
Definition gsLinearOperator.h:33
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Multigrid preconditioner.
Definition gsMultiGrid.h:58
index_t setNumPostSmooth() const
Get number of post-smoothing steps to perform.
Definition gsMultiGrid.h:317
index_t m_nLevels
Number of levels.
Definition gsMultiGrid.h:363
memory::shared_ptr< gsMultiGridOp > Ptr
Shared pointer for gsMultiGridOp.
Definition gsMultiGrid.h:63
gsMatrix< T > Matrix
Matrix type.
Definition gsMultiGrid.h:78
index_t numLevels() const
Number of levels in the multigrid construction.
Definition gsMultiGrid.h:256
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 m_numPreSmooth
Number of pre-smoothing steps.
Definition gsMultiGrid.h:381
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
std::vector< PrecondPtr > m_smoother
Smoothers on each level.
Definition gsMultiGrid.h:369
void setNumPostSmooth(index_t n)
Set number of post-smoothing steps to perform.
Definition gsMultiGrid.h:314
void stepT(const Matrix &rhs, Matrix &x) const override
Perform one transposed multigrid cycle.
Definition gsMultiGrid.h:213
gsLinearOperator< T >::Ptr OpPtr
Shared pointer to gsLinearOperator.
Definition gsMultiGrid.h:69
void setOptions(const gsOptionList &opt) override
Set the options based on a gsOptionList.
Definition gsMultiGrid.hpp:313
index_t setNumPreSmooth() const
Get number of pre-smoothing steps to perform.
Definition gsMultiGrid.h:311
index_t rows() const override
Returns the number of rows of the operator.
Definition gsMultiGrid.h:287
OpPtr coarseSolver() const
Get the solver for the coarsest problem (level 0)
Definition gsMultiGrid.h:305
void init(SpMatrixPtr fineMatrix, std::vector< SpMatrixRowMajorPtr > transferMatrices)
Init function that is used by matrix based constructors.
Definition gsMultiGrid.hpp:70
void setNumCycles(index_t n)
Definition gsMultiGrid.h:328
T coarseGridCorrectionDamping() const
Get the damping of for the coarse-grid correction.
Definition gsMultiGrid.h:352
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
void setSymmSmooth(bool s)
Definition gsMultiGrid.h:321
bool m_symmSmooth
Symmmetric smoothing.
Definition gsMultiGrid.h:387
void step(const Matrix &rhs, Matrix &x) const override
Perform one multigrid cycle.
Definition gsMultiGrid.h:203
T m_damping
Damping for the coarse-grid correction.
Definition gsMultiGrid.h:393
std::vector< OpPtr > m_restrict
Restriction matrix for each grid transition.
Definition gsMultiGrid.h:375
void setSmoother(index_t lvl, const PrecondPtr &sm)
Definition gsMultiGrid.hpp:284
index_t nDofs() const
Number of dofs for the finest level.
Definition gsMultiGrid.h:284
void smoothingStep(const Matrix &rhs, Matrix &x) const
Apply smoothing steps on finest grid.
Definition gsMultiGrid.h:189
void setCoarseSolver(const OpPtr &sol)
Set the solver for the coarsest problem (level 0)
Definition gsMultiGrid.h:302
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_ops
Underlying operators (=stiffness matrix) on each level.
Definition gsMultiGrid.h:366
gsSparseMatrix< T, RowMajor > SpMatrixRowMajor
Matrix type for transfers.
Definition gsMultiGrid.h:84
index_t finestLevel() const
The index of the finest level (0-based)
Definition gsMultiGrid.h:259
gsPreconditionerOp< T >::Ptr PrecondPtr
Shared pointer to gsPreconditionerOp.
Definition gsMultiGrid.h:72
memory::shared_ptr< SpMatrix > SpMatrixPtr
Smart pointer to sparse matrix type.
Definition gsMultiGrid.h:87
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
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
bool symmSmooth() const
Get symmetric post-smoothing option.
Definition gsMultiGrid.h:324
PrecondPtr smoother(index_t lvl) const
Definition gsMultiGrid.h:299
OpPtr m_coarseSolver
Solver for the coarsest-grid problem.
Definition gsMultiGrid.h:378
static uPtr make(SpMatrix fineMatrix, std::vector< SpMatrixRowMajor > transferMatrices, OpPtr coarseSolver=OpPtr())
Make function returning smart pointer.
Definition gsMultiGrid.h:136
const SpMatrix & matrix() const
Stiffness matrix for finest level.
Definition gsMultiGrid.h:278
void initCoarseSolver() const
Init solver on coarsest grid level.
Definition gsMultiGrid.hpp:102
OpPtr underlyingOp() const override
Underlying operator (=stiffness matrix) for finest level.
Definition gsMultiGrid.h:272
index_t cols() const override
Returns the number of columns of the operator.
Definition gsMultiGrid.h:290
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
gsVector< index_t > m_numCycles
Number of coarse-grid steps (1=V-cycle, 2=W-cycle)
Definition gsMultiGrid.h:390
void multiGridStep(index_t level, const Matrix &rhs, Matrix &x) const
Perform one multigrid cycle, starting from the given level.
Definition gsMultiGrid.hpp:148
index_t nDofs(index_t lvl) const
Number of dofs for the given level.
Definition gsMultiGrid.h:281
void setNumCycles(index_t lvl, index_t n)
Definition gsMultiGrid.h:339
gsSparseMatrix< T > SpMatrix
Sparse matrix type.
Definition gsMultiGrid.h:81
static gsOptionList defaultOptions()
Returns a list of default options.
Definition gsMultiGrid.hpp:300
memory::shared_ptr< SpMatrixRowMajor > SpMatrixRowMajorPtr
Smart pointer to matrix type for transfers.
Definition gsMultiGrid.h:90
index_t numCycles(index_t lvl) const
Get number of coarse grid steps to be applied.
Definition gsMultiGrid.h:346
index_t m_numPostSmooth
Number of post-smoothing steps.
Definition gsMultiGrid.h:384
OpPtr underlyingOp(index_t lvl) const
Underlying operator (=stiffness matrix) for given level.
Definition gsMultiGrid.h:269
void setUnderlyingOp(index_t lvl, OpPtr op)
Set underlying operator (=stiffness matrix) for certain level.
Definition gsMultiGrid.h:262
std::vector< OpPtr > m_prolong
Prolongation matrix for each grid transition.
Definition gsMultiGrid.h:372
void setCoarseGridCorrectionDamping(T damping)
Set the damping of for the coarse-grid correction.
Definition gsMultiGrid.h:349
gsPreconditionerOp< T > Base
Direct base class.
Definition gsMultiGrid.h:75
void setNumPreSmooth(index_t n)
Set number of pre-smoothing steps to perform.
Definition gsMultiGrid.h:308
memory::unique_ptr< gsMultiGridOp > uPtr
Unique pointer for gsMultiGridOp.
Definition gsMultiGrid.h:66
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
Simple abstract class for perconditioners.
Definition gsPreconditioner.h:43
memory::shared_ptr< gsPreconditionerOp > Ptr
Shared pointer for gsLinearOperator.
Definition gsPreconditioner.h:47
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define index_t
Definition gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Provides forward declarations of types and structs.
Provides a list of labeled parameters/options that can be set and accessed easily.
Simple abstract class for (discrete) linear preconditioners.
The G+Smo namespace, containing all definitions for the library.
S give(S &x)
Definition gsMemory.h:266