G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsPrimalSystem.h
Go to the documentation of this file.
1
14#pragma once
15
16#include <gsSolver/gsMatrixOp.h>
17#include <gsMatrix/gsVector.h>
18
19namespace gismo
20{
21
22
85template< typename T >
87{
88private:
90 typedef memory::shared_ptr<Op> OpPtr;
95public:
96
101
168 static void incorporateConstraints(
169 const std::vector<SparseVector>& primalConstraints,
172 SparseMatrix& modifiedLocalMatrix,
173 SparseMatrix& localEmbedding,
174 SparseMatrix& embeddingForBasis,
175 Matrix& rhsForBasis
176 );
177
195 OpPtr localSaddlePointSolver,
196 const SparseMatrix& embeddingForBasis,
197 const Matrix& rhsForBasis,
198 const std::vector<index_t>& primalDofIndices,
200 );
201
210 void addContribution(
211 const JumpMatrix& jumpMatrix,
213 const Matrix& localRhs,
215 OpPtr embedding = OpPtr()
216 );
217
251 const std::vector<SparseVector>& primalConstraints,
252 const std::vector<index_t>& primalDofIndices,
256 );
257
266 std::vector<Matrix> distributePrimalSolution( std::vector<Matrix> sol );
267
270 const JumpMatrix& jumpMatrix() const { return m_jumpMatrix; }
271
274 const SparseMatrix& localMatrix() const { return m_localMatrix; }
275
278 const Matrix& localRhs() const { return m_localRhs; }
279
281 index_t nPrimalDofs() const { return m_localMatrix.rows(); }
282
285
288
289private:
293 std::vector<SparseMatrix> m_primalBases;
294 std::vector<OpPtr> m_embeddings;
296};
297
298} // namespace gismo
299
300#ifndef GISMO_BUILD_LIB
301#include GISMO_HPP_HEADER(gsPrimalSystem.hpp)
302#endif
Simple abstract class for discrete operators.
Definition gsLinearOperator.h:29
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
This class represents the primal system for a IETI-DP algorithm.
Definition gsPrimalSystem.h:87
void setEliminatePointwiseConstraints(bool v)
Iff true, handleConstraints will eliminate pointwise constraints (typically vertex values)
Definition gsPrimalSystem.h:287
static gsSparseMatrix< T > primalBasis(OpPtr localSaddlePointSolver, const SparseMatrix &embeddingForBasis, const Matrix &rhsForBasis, const std::vector< index_t > &primalDofIndices, index_t nPrimalDofs)
Returns the matrix representation of the energy minimizing primal basis.
Definition gsPrimalSystem.hpp:141
gsMatrix< T > Matrix
Matrix type.
Definition gsPrimalSystem.h:94
SparseMatrix m_localMatrix
The overall matrix for the primal problem.
Definition gsPrimalSystem.h:291
Matrix & localRhs()
Returns the right-hand-side for the primal problem.
Definition gsPrimalSystem.h:277
static void incorporateConstraints(const std::vector< SparseVector > &primalConstraints, bool eliminatePointwiseConstraints, const SparseMatrix &localMatrix, SparseMatrix &modifiedLocalMatrix, SparseMatrix &localEmbedding, SparseMatrix &embeddingForBasis, Matrix &rhsForBasis)
Incorporates the given constraints in the local system.
Definition gsPrimalSystem.hpp:27
void addContribution(const JumpMatrix &jumpMatrix, const SparseMatrix &localMatrix, const Matrix &localRhs, SparseMatrix primalBasis, OpPtr embedding=OpPtr())
Adds contributions for a patch to the data hold in the class.
Definition gsPrimalSystem.hpp:179
JumpMatrix m_jumpMatrix
The jump matrix for the primal problem.
Definition gsPrimalSystem.h:290
memory::shared_ptr< Op > OpPtr
Shared pointer to linear operator.
Definition gsPrimalSystem.h:90
index_t eliminatePointwiseConstraints() const
Returns true iff handleConstraints will eliminate pointwise constraints (typically vertex values)
Definition gsPrimalSystem.h:284
JumpMatrix & jumpMatrix()
Returns the jump matrix for the primal problem.
Definition gsPrimalSystem.h:269
bool m_eliminatePointwiseConstraints
handleConstraints will eliminate pointwise constraints
Definition gsPrimalSystem.h:295
gsLinearOperator< T > Op
Linear operator.
Definition gsPrimalSystem.h:89
gsSparseMatrix< T > SparseMatrix
Sparse matrix type.
Definition gsPrimalSystem.h:91
gsSparseMatrix< T, RowMajor > JumpMatrix
Sparse matrix type for jumps.
Definition gsPrimalSystem.h:92
index_t nPrimalDofs() const
Returns the size of the primal problem (number of primal dofs)
Definition gsPrimalSystem.h:281
gsSparseVector< T > SparseVector
Sparse vector type.
Definition gsPrimalSystem.h:93
SparseMatrix & localMatrix()
Returns the local stiffness matrix for the primal problem.
Definition gsPrimalSystem.h:273
std::vector< SparseMatrix > m_primalBases
The bases for the primal dofs on the patches.
Definition gsPrimalSystem.h:293
void handleConstraints(const std::vector< SparseVector > &primalConstraints, const std::vector< index_t > &primalDofIndices, JumpMatrix &jumpMatrix, SparseMatrix &localMatrix, Matrix &localRhs)
Convenience function for handling the primal constraints.
Definition gsPrimalSystem.hpp:202
std::vector< Matrix > distributePrimalSolution(std::vector< Matrix > sol)
Distributes the given solution for K+1 subdomains to the K patches.
Definition gsPrimalSystem.hpp:232
Matrix m_localRhs
The right-hand side for the primal problem.
Definition gsPrimalSystem.h:292
std::vector< OpPtr > m_embeddings
For each patch, the map to .
Definition gsPrimalSystem.h:294
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
Sparse vector class, based on gsEigen::SparseVector.
Definition gsSparseVector.h:35
#define index_t
Definition gsConfig.h:32
Simple adapter classes to use matrices or linear solvers as gsLinearOperators.
Provides declaration of Vector class.
The G+Smo namespace, containing all definitions for the library.