25 this->m_localMatrixOps.reserve(n);
26 this->m_localRhs.reserve(n);
27 this->m_localSolverOps.reserve(n);
28 this->m_jumpMatrices.reserve(n);
34 GISMO_ASSERT( jumpMatrix->cols() == localMatrixOp->cols()
35 && localMatrixOp->rows() == localMatrixOp->cols()
36 && localRhs.rows() == localMatrixOp->cols(),
37 "gsIetiSystem::addPatch: Dimensions do not agree." );
39 GISMO_ASSERT( this->m_jumpMatrices.empty() || this->m_jumpMatrices[0]->rows() == jumpMatrix->rows(),
40 "gsIetiSystem::addPatch: The dimension of the given transfer matrix "
41 "is incompatible to the transfer matrices given previously." );
43 this->m_jumpMatrices.push_back(
give(jumpMatrix));
44 this->m_localMatrixOps.push_back(
give(localMatrixOp));
45 this->m_localRhs.push_back(
give(localRhs));
46 this->m_localSolverOps.push_back(
give(localSolverOp));
52 const size_t sz = this->m_localSolverOps.size();
53 for (
size_t i=0; i<sz; ++i)
55 if (!m_localSolverOps[i])
58 GISMO_ENSURE( matop,
"gsIetiSystem::setupSparseLUSolvers The local solvers can only "
59 "be computed on the fly if the local systems in localMatrixOps are of type "
60 "gsMatrixOp<gsSparseMatrix<T>>. Please provide solvers via members .addSubdomain "
70 const size_t sz = this->m_localMatrixOps.size();
72 for (
size_t i=0; i<sz; ++i)
76 result->
addOperator( i, sz, makeMatrixOp( this->m_jumpMatrices[i]->transpose() ) );
77 result->
addOperator( sz, i, makeMatrixOp( this->m_jumpMatrices[i] ) );
85 setupSparseLUSolvers();
93 setupSparseLUSolvers();
95 result.setZero( this->nLagrangeMultipliers(), this->m_localRhs[0].cols());
96 const index_t numPatches = this->m_jumpMatrices.size();
97 for (
index_t i=0; i<numPatches; ++i)
100 this->m_localSolverOps[i]->apply( this->m_localRhs[i], tmp );
101 result += *(this->m_jumpMatrices[i]) * tmp;
109 setupSparseLUSolvers();
111 const index_t numPatches = this->m_jumpMatrices.size();
112 std::vector<Matrix> result;
113 result.resize(numPatches);
114 for (
index_t i=0; i<numPatches; ++i)
116 this->m_localSolverOps[i]->apply( this->m_localRhs[i]-this->m_jumpMatrices[i]->transpose()*multipliers, result[i] );
124 const index_t sz = m_localMatrixOps.size();
125 index_t rows = nLagrangeMultipliers();
127 rows += m_localRhs[k].rows();
129 result.setZero(rows,m_localRhs[0].cols());
133 const index_t l = m_localRhs[k].rows();
134 result.middleRows(i, l) = m_localRhs[k];
143 const index_t sz = m_localMatrixOps.size();
144 std::vector<Matrix> result;
149 const index_t l = m_localRhs[k].rows();
150 result.push_back( x.middleRows(i, l) );
memory::shared_ptr< JumpMatrix > JumpMatrixPtr
Shared pointer to sparse matrix type for jumps.
Definition: gsIetiSystem.h:76
Matrix rhsForSchurComplement() const
Returns the right-hand-side that is required for the Schur complement formulation of the IETI problem...
Definition: gsIetiSystem.hpp:91
Matrix rhsForSaddlePoint() const
Returns the right-hand-side that is required for the saddle point formulation of the IETI problem...
Definition: gsIetiSystem.hpp:122
memory::shared_ptr< Op > OpPtr
Shared pointer to linear operator.
Definition: gsIetiSystem.h:72
std::vector< Matrix > constructSolutionFromSaddlePoint(const Matrix &x) const
Returns the local solutions for the individual subdomains.
Definition: gsIetiSystem.hpp:141
Simple class create a block preconditioner structure.
Allows to set up additive Schwarz type preconditioners.
OpPtr schurComplement() const
Returns gsLinearOperator that represents the Schur complement for the IETI problem.
Definition: gsIetiSystem.hpp:83
std::vector< Matrix > constructSolutionFromLagrangeMultipliers(const Matrix &multipliers) const
Returns the local solutions for the individual subdomains.
Definition: gsIetiSystem.hpp:107
Simple adapter class to use a matrix (or matrix-like object) as a linear operator. Needed for the iterative method classes.
Definition: gsMatrixOp.h:33
NestedMatrix matrix() const
Returns the matrix.
Definition: gsMatrixOp.h:84
S give(S &x)
Definition: gsMemory.h:266
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
void setupSparseLUSolvers() const
Setup solvers if not provided by user.
Definition: gsIetiSystem.hpp:50
void reserve(index_t n)
Reserves the memory required to store the number of subdomains.
Definition: gsIetiSystem.hpp:23
memory::shared_ptr< gsBlockOp< T > > Ptr
Shared pointer for gsBlockOp.
Definition: gsBlockOp.h:48
static uPtr make()
Definition: gsAdditiveOp.h:120
static uPtr make(index_t nRows, index_t nCols)
Make function returning a smart pointer.
Definition: gsBlockOp.h:60
void addSubdomain(JumpMatrixPtr jumpMatrix, OpPtr localMatrixOp, Matrix localRhs, OpPtr localSolverOp=OpPtr())
Definition: gsIetiSystem.hpp:32
void addOperator(index_t row, index_t col, const BasePtr &op)
Add a preconditioner to the block structure.
Definition: gsBlockOp.hpp:30
OpPtr saddlePointProblem() const
Returns gsLinearOperator that represents the IETI problem as saddle point problem.
Definition: gsIetiSystem.hpp:68