42 void setMaxIter(
int maxIter)
43 { this->maxIter = maxIter; }
45 void setTolerance(T tol)
48 void setNumLevels(
int numLevels,
int typeProjection,
int numDegree)
50 if(typeProjection == 1)
52 this->numLevels = numLevels - numDegree + 2;
56 this->numLevels = numLevels;
60 void setNumSmoothing(
int numSmoothing)
61 { this->numSmoothing = numSmoothing; }
63 void setTypeBCHandling(
int typeBCHandling)
64 { this->typeBCHandling = typeBCHandling; }
66 void setTypeCycle_h(
int typeCycle_h)
67 { this->typeCycle_h = typeCycle_h; }
69 void setTypeCycle_p(
int typeCycle_p)
70 { this->typeCycle_p = typeCycle_p; }
72 void setTypeLumping(
int typeLumping)
73 { this->typeLumping = typeLumping; }
75 void setTypeProjection(
int typeProjection)
76 { this->typeProjection = typeProjection; }
78 void setTypeSmoother(
int typeSmoother)
79 { this->typeSmoother = typeSmoother; }
91 int typeMultigrid = 2;
92 int typeCoarseOperator = 1;
119 int typeMultigrid = 2;
120 int typeCoarseOperator = 1;
138 const int& numLevels,
155 if (hp(std::max(numLevels-2,0),0) == 0 )
157 gsMatrix<T> fineRes, coarseRes, fineCorr, coarseCorr, postRes;
159 restriction(fineRes, coarseRes, numLevels, m_bases,
161 m_prolongation_P, m_restriction_P,
162 m_prolongation_M, m_restriction_M,
163 m_prolongation_H, m_restriction_H, hp);
165 coarseCorr.setZero(coarseRes.rows(),1);
166 for(
int j = 0 ; j < (typeCycle_p == 2 ? 2 : 1) ; j++)
168 solveMG(coarseRes, m_bases, coarseCorr, numLevels-1,
170 m_prolongation_P, m_restriction_P,
171 m_prolongation_M, m_restriction_M,
172 m_prolongation_H, m_restriction_H, hp);
176 m_prolongation_P, m_restriction_P,
177 m_prolongation_M, m_restriction_M,
178 m_prolongation_H, m_restriction_H, hp);
183 if (hp(std::max(numLevels-2,0),0) == 1 )
185 gsMatrix<T> fineRes, coarseRes, fineCorr, coarseCorr, postRes;
187 restriction(fineRes, coarseRes, numLevels, m_bases,
189 m_prolongation_P, m_restriction_P,
190 m_prolongation_M, m_restriction_M,
191 m_prolongation_H, m_restriction_H, hp);
193 coarseCorr.setZero(coarseRes.rows(),1);
194 for(
int i = 0 ; i < (typeCycle_h == 2 ? 2 : 1) ; i++)
196 solveMG(coarseRes, m_bases, coarseCorr, numLevels-1,
198 m_prolongation_P, m_restriction_P,
199 m_prolongation_M, m_restriction_M,
200 m_prolongation_H, m_restriction_H, hp);
204 m_prolongation_P, m_restriction_P,
205 m_prolongation_M, m_restriction_M,
206 m_prolongation_H, m_restriction_H, hp);
216 const int& numLevels,
217 const int& numDegree,
218 const int& typeMultigrid,
220 const int& typeCoarseOperator,
228 const int& numLevels,
229 const int& typeMultigrid,
231 const int& typeCoarseOperator){}
236 const int& numLevels,
243 const int& numLevels,
251 const int& numLevels) = 0;
272 const int& numLevels,
284 if (hp(numLevels-2,0) == 1)
286 Xfine = m_prolongation_H[numLevels-2]*Xcoarse;
290 if (typeLumping == 1)
292 gsMatrix<T> temp = m_prolongation_P[numLevels-2]*Xcoarse;
293 gsMatrix<T> M_L_inv = (m_prolongation_M[numLevels-2]).array().inverse();
294 Xfine = (M_L_inv).cwiseProduct(temp);
307 geometryMap G2 = ex2.
getMap(mp);
308 space w_n = ex2.
getSpace(basesH ,1, 0);
309 w_n.setInterfaceCont(0);
310 if (typeBCHandling == 1)
312 w_n.setup(bcInfo, dirichlet::l2Projection, 0);
320 gsMatrix<T> temp = m_prolongation_P[numLevels-2]*Xcoarse;
324 CGSolver.
solve(temp,Xfine);
332 const int& numLevels,
344 if (hp(numLevels-2,0) == 1)
346 Xcoarse = m_restriction_H[numLevels-2]*Xfine;
350 if (typeLumping == 1)
353 gsMatrix<T> temp = m_restriction_P[numLevels-2]*Xfine;
354 gsMatrix<T> M_L_inv = (m_restriction_M[numLevels-2]).array().inverse();
355 Xcoarse = (M_L_inv).cwiseProduct(temp);
368 geometryMap G2 = ex2.
getMap(mp);
369 space w_n = ex2.
getSpace(basesL, 1, 0);
370 w_n.setInterfaceCont(0);
371 if (typeBCHandling == 1)
373 w_n.setup(bcInfo, dirichlet::l2Projection, 0);
381 gsMatrix<T> temp = m_restriction_P[numLevels-2]*Xfine;
385 CGSolver.
solve(temp, Xcoarse);
399 template<
class T,
class CoarseSolver>
414 std::vector<memory::shared_ptr<gsMultiBasis<T> > >
m_bases;
435 std::vector< std::vector< gsSparseMatrix<T> > >
m_ILUT;
438 std::vector< std::vector < gsEigen::PermutationMatrix<Dynamic,Dynamic,index_t> > >
m_P;
441 std::vector < std::vector < gsEigen::PermutationMatrix<Dynamic,Dynamic,index_t> > >
m_Pinv;
444 std::vector< typename gsPreconditionerOp<T>::Ptr >
m_SCMS;
453 std::vector < std::vector < gsSparseMatrix<T> > >
m_ddB;
456 std::vector < std::vector < gsSparseMatrix<T> > >
m_ddC;
468 std::vector < gsSparseMatrix<T> >
m_S;
494 const int& numLevels,
495 const int& numDegree,
496 const int& typeMultigrid,
498 const int& typeCoarseOperator,
502 for (
int i = 1; i < numLevels; i++)
505 switch((
int) hp(i-1,0) )
507 case 0 : (Base::typeProjection == 1 ?
508 m_bases.back()->degreeIncrease(numDegree-1) :
509 m_bases.back()->degreeIncrease());
break;
511 case 1 :
m_bases.back()->uniformRefine();
break;
513 case 2:
m_bases.back()->uniformRefine();
514 m_bases.back()->degreeIncrease();
break;
523 for (
int i = 0; i < numLevels; i++)
546 u_K.setInterfaceCont(0);
547 u_M.setInterfaceCont(0);
559 K.
assemble( igrad(u_K, G_K) * igrad(u_K, G_K).tr() *
meas(G_K), u_K * ff_K *
meas(G_K) );
575 real_t Time_Assembly = clock.
stop();
589 for (
int i = 1; i < numLevels; i++)
603 Base::typeBCHandling == 1 ? options.
addInt(
"DirichletStrategy",
"",dirichlet::elimination) : options.
addInt(
"DirichletStrategy",
"",dirichlet::nitsche);
604 for(
int i = 1; i < numLevels; i++)
614 real_t Time_Transfer = clock.
stop();
619 if (typeCoarseOperator == 2)
621 for (
int i = numLevels-1; i > -1; i--)
623 if (hp(hp.rows()-1,0) == 0)
625 if (hp(std::min(i,hp.rows()-1),0) == 1)
632 if (hp(std::min(i,hp.rows()-1),0) == 1 && i > 0)
639 real_t Time_Assembly_Galerkin = clock.
stop();
644 if (Base::typeSmoother == 3)
649 opt.
addReal(
"Scaling",
"",0.12);
650 for(
int i = 0 ; i < numLevels ; i++)
655 real_t Time_SCMS = clock.
stop();
660 int numPatch =
m_mp_ptr->nPatches();
662 if (Base::typeSmoother == 1)
666 m_P.resize(numLevels);
668 for(
int i = 0; i < numLevels; i++)
673 if (Base::typeProjection == 2)
675 gsEigen::IncompleteLUT<real_t> ilu;
676 ilu.setFillfactor(1);
678 m_ILUT[i][0] = ilu.factors();
679 m_P[i][0] = ilu.fillReducingPermutation();
680 m_Pinv[i][0] = ilu.inversePermutation();
684 if (i == numLevels-1)
686 gsEigen::IncompleteLUT<real_t> ilu;
687 ilu.setFillfactor(1);
689 m_ILUT[i][0] = ilu.factors();
690 m_P[i][0] = ilu.fillReducingPermutation();
691 m_Pinv[i][0] = ilu.inversePermutation();
696 real_t Time_ILUT_Factorization = clock.
stop();
700 if (Base::typeSmoother == 5)
703 m_ddB.resize(numLevels);
704 m_ddC.resize(numLevels);
709 m_P.resize(numLevels);
712 m_S.resize(numLevels);
714 for(
int i = 0 ; i < numLevels ; i++)
717 m_ILUT[i].resize(numPatch+1);
718 m_P[i].resize(numPatch+1);
719 m_Pinv[i].resize(numPatch+1);
722 std::vector<gsVector<index_t> > interior,
boundary;
723 std::vector<std::vector<gsVector<index_t> > > interface;
724 std::vector<gsMatrix<index_t> > global_interior, global_boundary;
725 std::vector<std::vector<gsMatrix<index_t> > > global_interface;
727 for(
int l=0; l< numPatch; l++)
729 m_shift[i][l] = global_interior[l].rows();
736 for(
int j = 0 ; j < numPatch ; j++)
739 gsEigen::IncompleteLUT<real_t> ilu;
740 ilu.setFillfactor(1);
742 m_ILUT[i][j] = ilu.factors();
744 m_P[i][j] = ilu.fillReducingPermutation();
745 m_Pinv[i][j] = ilu.inversePermutation();
746 shift0 = shift0 +
m_shift[i][j];
752 m_ddB[i].resize(numPatch+1);
753 m_ddC[i].resize(numPatch+1);
755 for(
int j = 0 ; j < numPatch+1 ; j++)
759 shift0 = shift0 +
m_shift[i][j];
765 for(
int i = 0 ; i < numLevels ; i++)
771 for(
int k=0; k< numPatch; k++)
774 shift0 = shift0 +
m_shift[i][k];
780 for(
int j=0 ; j < numPatch ; j ++)
784 for(
int k=0 ; k < m_shift[i][numPatch]; k++)
788 m_ddBtilde[i][j].col(k) =
m_ILUT[i][j].template triangularView<gsEigen::Upper>().transpose().solve(Brhs);
789 m_ddCtilde[i][j].col(k) =
m_ILUT[i][j].template triangularView<gsEigen::UnitLower>().
solve(Crhs);
795 for(
int l = 0 ; l < numPatch ; l++)
801 for(
int m = 0 ; m < numPatch ; m++)
805 shift0 = shift0 +
m_shift[i][m];
810 gsEigen::IncompleteLUT<real_t> ilu;
811 ilu.setFillfactor(1);
818 real_t Time_Block_ILUT_Factorization = clock.
stop();
834 const int& numLevels,
835 const int& typeMultigrid,
837 const int& typeCoarseOperator)
843 real_t r0 = (
m_operator[numLevels-1]*x - b).norm();
851 while( r/b.norm() > Base::tol && iter < Base::maxIter )
863 gsInfo <<
"Residual increased during solving!!! " <<std::endl;
869 real_t Time_Solve = clock.
stop();
882 const int& numLevels)
886 solver.analyzePattern(
m_operator[numLevels-1]);
888 x = solver.solve(rhs);
905 space w_n = ex2.
getSpace(basesH ,1, 0);
906 w_n.setInterfaceCont(0);
907 if (Base::typeBCHandling == 1)
932 space v_n = ex.
getSpace(basesH ,1, 0);
933 v_n.setInterfaceCont(0);
935 u_n.setInterfaceCont(0);
936 if (Base::typeBCHandling == 1)
964 space w_n = ex2.
getSpace(basesL ,1, 0);
965 w_n.setInterfaceCont(0);
966 if (Base::typeBCHandling == 1)
992 space v_n = ex.
getSpace(basesH ,1, 0);
993 v_n.setInterfaceCont(0);
995 u_n.setInterfaceCont(0);
996 if (Base::typeBCHandling == 1)
1013 const int& numLevels,
1018 for(
int i = 0 ; i < Base::numSmoothing ; i++)
1020 if (Base::typeSmoother == 1)
1022 if (hp(numLevels-2,0) == 1 && hp(hp.rows()-1,0) == 0)
1024 internal::gaussSeidelSweep(
m_operator[numLevels-1],x,rhs);
1030 e =
m_Pinv[numLevels-1][0]*d;
1031 e =
m_ILUT[numLevels-1][0].template triangularView<gsEigen::UnitLower>().
solve(e);
1032 e =
m_ILUT[numLevels-1][0].template triangularView<gsEigen::Upper>().
solve(e);
1033 e =
m_P[numLevels-1][0]*e;
1037 if (Base::typeSmoother == 2)
1039 internal::gaussSeidelSweep(
m_operator[numLevels-1],x,rhs);
1041 if (Base::typeSmoother == 3)
1043 m_SCMS[numLevels-1]->step(rhs,x);
1045 if (Base::typeSmoother == 5)
1047 if (hp(numLevels-2,0) == 1 && hp(hp.rows()-1,0) == 0)
1049 internal::gaussSeidelSweep(
m_operator[numLevels-1],x,rhs);
1055 e =
m_A_aprox[numLevels-1].template triangularView<gsEigen::UnitLower>().
solve(d);
1056 e =
m_A_aprox[numLevels-1].template triangularView<gsEigen::Upper>().
solve(e);
1068 const int& numLevels,
1074 x = x - alpha*fineCorr;
1077 for(
int i = 0 ; i < Base::numSmoothing ; i++)
1079 if (Base::typeSmoother == 1)
1081 if (hp(numLevels-2,0) == 1 && hp(hp.rows()-1,0) == 0)
1083 internal::gaussSeidelSweep(
m_operator[numLevels-1],x,rhs);
1089 e =
m_Pinv[numLevels-1][0]*d;
1090 e =
m_ILUT[numLevels-1][0].template triangularView<gsEigen::UnitLower>().
solve(e);
1091 e =
m_ILUT[numLevels-1][0].template triangularView<gsEigen::Upper>().
solve(e);
1092 e =
m_P[numLevels-1][0]*e;
1096 if (Base::typeSmoother == 2)
1098 internal::gaussSeidelSweep(
m_operator[numLevels-1],x,rhs);
1100 if (Base::typeSmoother == 3)
1102 m_SCMS[numLevels-1]->step(rhs,x);
1104 if (Base::typeSmoother == 5)
1106 if (hp(numLevels-2,0) == 1 && hp(hp.rows()-1,0) == 0)
1108 internal::gaussSeidelSweep(
m_operator[numLevels-1],x,rhs);
1114 e =
m_A_aprox[numLevels-1].template triangularView<gsEigen::UnitLower>().
solve(d);
1115 e =
m_A_aprox[numLevels-1].template triangularView<gsEigen::Upper>().
solve(e);
1133 typeBCHandling == 1 ? (dirichlet::strategy)opt.
askInt(
"DirichletStrategy",11) : (dirichlet::strategy)opt.
askInt(
"DirichletStrategy",14),
1134 (iFace ::strategy)opt.
askInt(
"InterfaceStrategy", 1),
1139 const index_t nTotalDofs = dm.freeSize();
1142 std::vector< std::vector<patchComponent> > components = mb.topology().
allComponents(
true);
1143 const index_t nr_components = components.size();
1147 for(
index_t ps=0; ps < 2*dim; ++ps )
1151 std::vector< gsSparseMatrix<real_t,RowMajor> > transfers;
1152 transfers.reserve(nr_components);
1153 std::vector< gsLinearOperator<>::Ptr > ops;
1154 ops.reserve(nr_components);
1156 for (
index_t i=0; i<nr_components; ++i)
1164 se.add(indices(i,0),i,real_t(1));
1166 transfer.setFrom(se);
1169 if (bases[0]->dim() == dim)
1171 GISMO_ASSERT ( bases.size() == 1,
"Only one basis is expected for each patch." );
1184 ops.push_back( makeSparseCholeskySolver(mat) );
1186 transfers.push_back(
give(transfer));
std::vector< gsSparseMatrix< T > > m_restriction_P
std::vector of restriction operators
Definition: gsXBraidMultigrid.h:420
gsBasis< T >::uPtr componentBasis_withIndices(patchComponent pc, const gsDofMapper &dm, gsMatrix< index_t > &indices, bool no_lower=true) const
Returns the basis that corresponds to the component.
Definition: gsMultiBasis.hpp:262
Class that provides a container for triplets (i,j,value) to be filled in a sparse matrix...
Definition: gsSparseMatrix.h:33
void solve(const VectorType &rhs, VectorType &x)
Solves the linear system and stores the solution in x.
Definition: gsIterativeSolver.h:114
Definition: gsExprAssembler.h:30
virtual void postsmoothing(const gsMatrix< T > &rhs, gsMatrix< T > &x, const int &numLevels, gsMatrix< T > &fineCorr, gsMatrix< T > &postRes, const gsMatrix< T > &hp)
Apply fixed number of postsmoothing steps.
Definition: gsXBraidMultigrid.h:1066
virtual gsSparseMatrix< T > restriction_P(const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases)
Construct restriction operator at level numLevels.
Definition: gsXBraidMultigrid.h:978
gsXBraidMultigridBase()
Constructor.
Definition: gsXBraidMultigrid.h:29
The p-multigrid base class provides the basic methods (smoothing, prolongation, restriction) for impl...
Definition: gsXBraidMultigrid.h:12
shared_ptr< T > make_shared_not_owned(const T *x)
Creates a shared pointer which does not eventually delete the underlying raw pointer. Usefull to refer to objects which should not be destroyed.
Definition: gsMemory.h:189
std::vector< std::vector< gsSparseMatrix< T > > > m_ddC
std::vector of std::vector of block operator objects
Definition: gsXBraidMultigrid.h:456
gsExprHelper< T >::geometryMap geometryMap
Geometry map type.
Definition: gsExprAssembler.h:58
Dirichlet type.
Definition: gsBoundaryConditions.h:31
virtual void postsmoothing(const gsMatrix< T > &rhs, gsMatrix< T > &x, const int &numLevels, gsMatrix< T > &fineCorr, gsMatrix< T > &postRes, const gsMatrix< T > &hp)=0
Apply fixed number of smoothing steps (pure virtual method)
std::vector< std::vector< int > > m_shift
std::vector of std::vector of shift objects
Definition: gsXBraidMultigrid.h:471
short_t dim() const
Dimension of the boxes.
Definition: gsBoxTopology.h:98
Main header to be included by clients using the G+Smo library.
std::vector< gsMatrix< T > > m_restriction_M
std::vector of restriction operators
Definition: gsXBraidMultigrid.h:426
virtual gsXBraidMultigridBase & compute(const gsSparseMatrix< T > &mat, const T tstep, const int &numDegree, index_t typeMethod)
Definition: gsXBraidMultigrid.h:84
#define short_t
Definition: gsConfig.h:35
space getTestSpace(const gsFunctionSet< T > &mp, index_t dim=1, index_t id=0)
Definition: gsExprAssembler.h:192
std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases
std::vector of multi-basis objects
Definition: gsXBraidMultigrid.h:414
void solve(const gsFunctionExpr< T > &rhs, gsMatrix< T > &x, gsMatrix< T > f, const int &iterTot, const int &numLevels, const int &typeMultigrid, const gsMatrix< T > &hp, const int &typeCoarseOperator)
Apply p-multigrid solver to given right-hand side on level l.
Definition: gsXBraidMultigrid.h:830
Struct that defines the boundary sides and corners and types of a geometric object.
Definition: gsBoundary.h:55
std::vector< gsMatrix< T > > m_prolongation_M
std::vector of prolongation operators
Definition: gsXBraidMultigrid.h:423
std::vector< std::vector< gsEigen::PermutationMatrix< Dynamic, Dynamic, index_t > > > m_P
std::vector of factorized operators
Definition: gsXBraidMultigrid.h:438
The conjugate gradient method.
Definition: gsConjugateGradient.h:29
Generic preconditioner which applies an arbitrary linear operator to the residual.
Definition: gsAdditiveOp.h:50
virtual gsSparseMatrix< T > restriction_P(const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases)=0
Prolongate coarse space function to fine space.
S give(S &x)
Definition: gsMemory.h:266
void assemble(const expr &...args)
Adds the expressions args to the system matrix/rhs The arguments are considered as integrals over the...
Definition: gsExprAssembler.h:756
std::vector< gsSparseMatrix< T > > m_prolongation_H
std::vector of prolongation operators
Definition: gsXBraidMultigrid.h:429
#define index_t
Definition: gsConfig.h:32
memory::shared_ptr< gsBoundaryConditions< T > > m_bcInfo_ptr
Shared pointer to boundary conditions.
Definition: gsXBraidMultigrid.h:411
gsXBraidMultigridBase< T > Base
Base class type.
Definition: gsXBraidMultigrid.h:405
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition: gsMatrix.h:38
virtual gsSparseMatrix< T > prolongation_P(const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases)
Construct prolongation operator at level numLevels.
Definition: gsXBraidMultigrid.h:919
virtual void solveMG(const gsMatrix< T > &rhs, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases, gsMatrix< T > &x, const int &numLevels, gsBoundaryConditions< T > bcInfo, gsMultiPatch< T > mp, std::vector< gsSparseMatrix< T > > &m_prolongation_P, std::vector< gsSparseMatrix< T > > &m_restriction_P, std::vector< gsMatrix< T > > &m_prolongation_M, std::vector< gsMatrix< T > > &m_restriction_M, std::vector< gsSparseMatrix< T > > &m_prolongation_H, std::vector< gsSparseMatrix< T > > &m_restriction_H, const gsMatrix< T > &hp)
Apply p-multigrid solver to given right-hand side on level l.
Definition: gsXBraidMultigrid.h:135
virtual gsMatrix< T > restriction_M(const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases)=0
Prolongate coarse space function to fine space.
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
virtual gsSparseMatrix< T > prolongation_P(const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases)=0
Prolongate coarse space function to fine space.
Maintains a mapping from patch-local dofs to global dof indices and allows the elimination of individ...
Definition: gsDofMapper.h:68
const gsMatrix< T > & rhs() const
Returns the right-hand side vector(s)
Definition: gsExprAssembler.h:129
void addInt(const std::string &label, const std::string &desc, const index_t &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:201
const gsSparseMatrix< T > & matrix() const
Returns the left-hand global matrix.
Definition: gsExprAssembler.h:116
virtual gsMatrix< T > restriction_M(const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases)
Construct restriction operator at level numLevels.
Definition: gsXBraidMultigrid.h:951
virtual void solvecoarse(const gsMatrix< T > &rhs, gsMatrix< T > &x, const int &numLevels)
Apply coarse solver.
Definition: gsXBraidMultigrid.h:880
memory::shared_ptr< gsMultiPatch< T > > m_mp_ptr
Shared pointer to multi-patch geometry.
Definition: gsXBraidMultigrid.h:408
std::vector< std::vector< gsMatrix< T > > > m_ddCtilde
std::vector of std::vector of block operator objects
Definition: gsXBraidMultigrid.h:462
static uPtr make(BasePtr underlying, BasePtr preconditioner, T tau=(T) 1)
Make function returning a smart pointer.
Definition: gsPreconditioner.h:188
Holds a set of patch-wise bases and their topology information.
Definition: gsMultiBasis.h:36
virtual void presmoothing(const gsMatrix< T > &rhs, gsMatrix< T > &x, const int &numLevels, gsMatrix< T > &fineRes, const gsMatrix< T > &hp)
Apply fixed number of presmoothing steps.
Definition: gsXBraidMultigrid.h:1011
The p-multigrid class implements a generic p-multigrid solver that can be customized by passing assem...
Definition: gsXBraidMultigrid.h:400
std::vector< typename gsPreconditionerOp< T >::Ptr > m_SCMS
std::vector of SCM smoother object
Definition: gsXBraidMultigrid.h:444
std::vector< std::vector< gsSparseMatrix< T > > > m_block_operator
std::vector of std::vector of block operator objects
Definition: gsXBraidMultigrid.h:450
virtual gsMatrix< T > prolongation_M(const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases)=0
Prolongate coarse space function to fine space.
void restart()
Start taking the time.
Definition: gsStopwatch.h:80
std::vector< gsSparseMatrix< T > > m_prolongation_P
std::vector of prolongation operators
Definition: gsXBraidMultigrid.h:417
std::vector< gsSparseMatrix< T > > m_operator
std::vector of operator objects
Definition: gsXBraidMultigrid.h:447
#define gsInfo
Definition: gsDebug.h:43
double stop()
Return elapsed time in seconds.
Definition: gsStopwatch.h:83
Definition: gsDirichletValues.h:23
void setTolerance(T tol)
Set the tolerance for the error criteria on the relative residual error (default: 1e-10) ...
Definition: gsIterativeSolver.h:223
std::vector< gsSparseMatrix< T > > m_restriction_H
std::vector of restriction operators
Definition: gsXBraidMultigrid.h:432
geometryMap getMap(const gsFunctionSet< T > &g)
Registers g as an isogeometric geometry map and return a handle to it.
Definition: gsExprAssembler.h:161
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
space getSpace(const gsFunctionSet< T > &mp, index_t dim=1, index_t id=0)
Definition: gsExprAssembler.h:166
virtual void restriction(const gsMatrix< T > &Xfine, gsMatrix< T > &Xcoarse, const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases, gsBoundaryConditions< T > bcInfo, gsMultiPatch< T > mp, std::vector< gsSparseMatrix< T > > &m_prolongation_P, std::vector< gsSparseMatrix< T > > &m_restriction_P, std::vector< gsMatrix< T > > &m_prolongation_M, std::vector< gsMatrix< T > > &m_restriction_M, std::vector< gsSparseMatrix< T > > &m_prolongation_H, std::vector< gsSparseMatrix< T > > &m_restriction_H, const gsMatrix< T > &hp)
Restrict fine space function to coarse space.
Definition: gsXBraidMultigrid.h:330
A Stopwatch object can be used to measure execution time of code, algorithms, etc.
Definition: gsStopwatch.h:72
virtual gsMatrix< T > prolongation_M(const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases)
Construct prolongation operator at level numLevels.
Definition: gsXBraidMultigrid.h:892
std::vector< std::vector< gsSparseMatrix< T > > > m_ddB
std::vector of std::vector of block operator objects
Definition: gsXBraidMultigrid.h:453
std::vector< std::vector< gsEigen::PermutationMatrix< Dynamic, Dynamic, index_t > > > m_Pinv
std::vector of factorized operators
Definition: gsXBraidMultigrid.h:441
virtual void prolongation(const gsMatrix< T > &Xcoarse, gsMatrix< T > &Xfine, const int &numLevels, std::vector< memory::shared_ptr< gsMultiBasis< T > > > m_bases, gsBoundaryConditions< T > bcInfo, gsMultiPatch< T > mp, std::vector< gsSparseMatrix< T > > &m_prolongation_P, std::vector< gsSparseMatrix< T > > &m_restriction_P, std::vector< gsMatrix< T > > &m_prolongation_M, std::vector< gsMatrix< T > > &m_restriction_M, std::vector< gsSparseMatrix< T > > &m_prolongation_H, std::vector< gsSparseMatrix< T > > &m_restriction_H, const gsMatrix< T > &hp)
Prolongate coarse space function to fine space.
Definition: gsXBraidMultigrid.h:270
Class containing a set of boundary conditions.
Definition: gsBoundaryConditions.h:341
Class defining a multivariate (real or vector) function given by a string mathematical expression...
Definition: gsFunctionExpr.h:51
index_t askInt(const std::string &label, const index_t &value=0) const
Reads value for option label from options.
Definition: gsOptionList.cpp:117
void addReal(const std::string &label, const std::string &desc, const Real &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:211
#define GISMO_UNUSED(x)
Definition: gsDebug.h:112
void addCondition(int p, boxSide s, condition_type::type t, gsFunctionSet< T > *f, short_t unknown=0, bool parametric=false, int comp=-1)
Adds another boundary condition.
Definition: gsBoundaryConditions.h:650
Provides robust preconditioners for single patch geometries.
Definition: gsPatchPreconditionersCreator.h:29
virtual void presmoothing(const gsMatrix< T > &rhs, gsMatrix< T > &x, const int &numLevels, gsMatrix< T > &fineRes, const gsMatrix< T > &hp)=0
Apply fixed number of smoothing steps (pure virtual method)
std::vector< std::vector< patchComponent > > allComponents(bool combineCorners=false) const
Returns all components representing the topology.
Definition: gsBoxTopology.cpp:294
EIGEN_STRONG_INLINE meas_expr< T > meas(const gsGeometryMap< T > &G)
The measure of a geometry map.
Definition: gsExpressions.h:4557
virtual gsMatrix< T > solveWithGuess(const gsMatrix< T > &b, const gsMatrix< T > &x0)
Definition: gsXBraidMultigrid.h:110
std::vector< gsMatrix< T > > m_A_aprox
std::vector of std::vector of block operator objects
Definition: gsXBraidMultigrid.h:465
virtual void solvecoarse(const gsMatrix< T > &rhs, gsMatrix< T > &x, const int &numLevels)=0
Apply coarse solver (pure virtual method)
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
std::vector< gsSparseMatrix< T > > m_S
std::vector of std::vector of block operator objects
Definition: gsXBraidMultigrid.h:468
std::vector< std::vector< gsMatrix< T > > > m_ddBtilde
std::vector of std::vector of block operator objects
Definition: gsXBraidMultigrid.h:459
std::vector< std::vector< gsSparseMatrix< T > > > m_ILUT
std::vector of factorized operators
Definition: gsXBraidMultigrid.h:435
void setIntegrationElements(const gsMultiBasis< T > &mesh)
Sets the domain of integration.
Definition: gsExprAssembler.h:136
void setup(const gsFunctionExpr< T > &rhs, gsMatrix< T > &x, gsMatrix< T > f, const int &iterTot, const int &numLevels, const int &numDegree, const int &typeMultigrid, const gsMatrix< T > &hp, const int &typeCoarseOperator, T tstep, index_t typeMethod)
Set-up p-multigrid solver.
Definition: gsXBraidMultigrid.h:490
expr::gsFeSolution< T > solution
Solution type.
Definition: gsExprAssembler.h:61
void initSystem(const index_t numRhs=1)
Initializes the sparse system (sparse matrix and rhs)
Definition: gsExprAssembler.h:290
variable getCoeff(const gsFunctionSet< T > &func)
Definition: gsExprAssembler.h:260
Definition: gsExpressions.h:114
Real getReal(const std::string &label) const
Reads value for option label from options.
Definition: gsOptionList.cpp:44
void uniformCoarsen_withTransfer(gsSparseMatrix< T, RowMajor > &transfer, const gsBoundaryConditions< T > &boundaryConditions, const gsOptionList &assemblerOptions, int numKnots=1, index_t unk=0)
Coarsen every basis uniformly.
Definition: gsMultiBasis.hpp:222
memory::shared_ptr< gsPreconditionerOp > Ptr
Shared pointer for gsLinearOperator.
Definition: gsPreconditioner.h:47