24 gsSortedVector<index_t>
28 for (
index_t i=0; i<jm.outerSize(); ++i)
29 for (
typename JumpMatrix::InnerIterator it(jm, i); it; ++it)
30 result.push_sorted_unique(it.col());
39 reverse.setZero( jm.cols() );
42 reverse[dofs[i]] = i+1;
45 triplets.reserve(jm.nonZeros());
46 for (
index_t i=0; i<jm.outerSize(); ++i)
47 for (
typename JumpMatrix::InnerIterator it(jm, i); it; ++it)
48 if (reverse[it.col()] > 0)
58 result.setFrom(triplets);
67 reverse.setZero( mat.cols() );
70 reverse[dofs[i]] = i+1;
72 for (
index_t i=0; i<mat.cols(); ++i)
77 se_A00.reserve( 2 * mat.nonZeros() * dofs.size() / mat.rows() );
78 se_A01.reserve( 2 * mat.nonZeros() * dofs.size() / mat.rows() );
79 se_A10.reserve( 2 * mat.nonZeros() * dofs.size() / mat.rows() );
80 se_A11.reserve( mat.nonZeros() );
81 for (
index_t i=0; i<mat.outerSize(); ++i)
82 for (
typename SparseMatrix::InnerIterator it(mat, i); it; ++it)
84 if (reverse[it.row()] > 0 && reverse[it.col()] > 0)
92 else if (reverse[it.row()] > 0 && reverse[it.col()] < 0)
100 else if (reverse[it.row()] < 0 && reverse[it.col()] > 0)
103 -reverse[it.row()]-1,
111 -reverse[it.row()]-1,
112 -reverse[it.col()]-1,
120 result.A00.resize( dofs.size(), dofs.size());
121 result.A00.setFrom(se_A00);
122 result.A01.resize(mat.rows()-dofs.size(), dofs.size());
123 result.A01.setFrom(se_A01);
124 result.A10.resize( dofs.size(), mat.rows()-dofs.size());
125 result.A10.setFrom(se_A10);
126 result.A11.resize(mat.rows()-dofs.size(), mat.rows()-dofs.size());
127 result.A11.setFrom(se_A11);
137 matrixBlocks.A01 *= -1;
139 makeMatrixOp(matrixBlocks.A00.
moveToPtr()),
141 makeMatrixOp(matrixBlocks.A01.
moveToPtr()),
143 makeMatrixOp(matrixBlocks.A10.
moveToPtr())
151 const index_t pnr = m_jumpMatrices.size();
155 const index_t sz = m_localSchurOps[k]->rows();
164 for (
index_t i=0; i<jm.outerSize(); ++i){
165 for (
typename JumpMatrix::InnerIterator it(jm, i); it; ++it)
178 const index_t pnr = m_jumpMatrices.size();
182 GISMO_ASSERT( m_localScaling[i].rows() > 0 && m_localScaling[i].cols() == 1,
183 "gsScaledDirichletPrec::preconditioner needs the local scaling matrices given. "
184 "Forgot to call setupMultiplicityScaling()?" );
187 std::vector<OpPtr> scalingOps;
188 scalingOps.reserve(pnr);
192 const index_t sz = m_localSchurOps[k]->rows();
195 scaling(i,i) = (T)1/m_localScaling[k](i,0);
196 scalingOps.push_back(makeMatrixOp(scaling.
moveToPtr()));
static uPtr make()
Make command returning a smart pointer.
Definition: gsProductOp.h:77
static uPtr make()
Make command returning a smart pointer.
Definition: gsSumOp.h:70
Class that provides a container for triplets (i,j,value) to be filled in a sparse matrix...
Definition: gsSparseMatrix.h:33
Definition: gsScaledDirichletPrec.h:148
memory::shared_ptr< Op > OpPtr
Shared pointer to linear operator.
Definition: gsScaledDirichletPrec.h:81
memory::shared_ptr< gsProductOp > Ptr
Shared pointer for gsProductOp.
Definition: gsProductOp.h:39
static OpPtr schurComplement(Blocks matrixBlocks, OpPtr solver)
Computes the Schur complement with respect to the block A11 of matrixBlocks.
Definition: gsScaledDirichletPrec.hpp:135
Allows to set up additive Schwarz type preconditioners.
uPtr moveToPtr()
This function returns a smart pointer to the matrix. After calling it, the matrix object becomes empt...
Definition: gsSparseMatrix.h:249
static JumpMatrix restrictJumpMatrix(const JumpMatrix &jumpMatrix, const std::vector< index_t > &dofs)
Restricts the jump matrix to the given dofs.
Definition: gsScaledDirichletPrec.hpp:36
S give(S &x)
Definition: gsMemory.h:266
#define index_t
Definition: gsConfig.h:32
This class is derived from std::vector, and adds sort tracking.
Definition: gsSortedVector.h:109
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
static Blocks matrixBlocks(const SparseMatrix &localMatrix, const std::vector< index_t > &dofs)
Computes the matrix blocks with respect to the given dofs.
Definition: gsScaledDirichletPrec.hpp:64
Class for representing the product of objects of type gsLinearOperator as gsLinearOperator.
Definition: gsProductOp.h:33
void setupMultiplicityScaling()
This sets up the member vector localScaling based on multiplicity scaling.
Definition: gsScaledDirichletPrec.hpp:149
memory::shared_ptr< gsAdditiveOp > Ptr
Shared pointer.
Definition: gsAdditiveOp.h:62
void addOperator(BasePtr op)
Add another operator at the end.
Definition: gsProductOp.h:93
static uPtr make()
Definition: gsAdditiveOp.h:120
static gsSortedVector< index_t > skeletonDofs(const JumpMatrix &jumpMatrix)
Extracts the skeleton dofs from the jump matrix.
Definition: gsScaledDirichletPrec.hpp:25
A class representing the product of gsLinearOperator s.
OpPtr preconditioner() const
This returns the preconditioner as gsLinearOperator.
Definition: gsScaledDirichletPrec.hpp:176
void addOperator(Transfer transfer, OpPtr op)
Definition: gsAdditiveOp.h:146
Provides the sum of gsLinearOperator s as a gsLinearOperator.