G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
19 namespace gismo
20 {
21 
22 
85 template< typename T >
87 {
88 private:
90  typedef memory::shared_ptr<Op> OpPtr;
94  typedef gsMatrix<T> Matrix;
95 public:
96 
101 
168  static void incorporateConstraints(
169  const std::vector<SparseVector>& primalConstraints,
171  const SparseMatrix& localMatrix,
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,
212  const SparseMatrix& localMatrix,
213  const Matrix& localRhs,
215  OpPtr embedding = OpPtr()
216  );
217 
250  void handleConstraints(
251  const std::vector<SparseVector>& primalConstraints,
252  const std::vector<index_t>& primalDofIndices,
253  JumpMatrix& jumpMatrix,
254  SparseMatrix& localMatrix,
255  Matrix& localRhs
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 
277  Matrix& localRhs() { return m_localRhs; }
278  const Matrix& localRhs() const { return m_localRhs; }
279 
281  index_t nPrimalDofs() const { return m_localMatrix.rows(); }
282 
285 
288 
289 private:
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
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
std::vector< SparseMatrix > m_primalBases
The bases for the primal dofs on the patches.
Definition: gsPrimalSystem.h:293
Provides declaration of Vector class.
gsMatrix< T > Matrix
Matrix type.
Definition: gsPrimalSystem.h:94
gsLinearOperator< T > Op
Linear operator.
Definition: gsPrimalSystem.h:89
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
Matrix & localRhs()
Returns the right-hand-side for the primal problem.
Definition: gsPrimalSystem.h:277
index_t nPrimalDofs() const
Returns the size of the primal problem (number of primal dofs)
Definition: gsPrimalSystem.h:281
#define index_t
Definition: gsConfig.h:32
gsSparseMatrix< T, RowMajor > JumpMatrix
Sparse matrix type for jumps.
Definition: gsPrimalSystem.h:92
void setEliminatePointwiseConstraints(bool v)
Iff true, handleConstraints will eliminate pointwise constraints (typically vertex values) ...
Definition: gsPrimalSystem.h:287
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
JumpMatrix & jumpMatrix()
Returns the jump matrix for the primal problem.
Definition: gsPrimalSystem.h:269
index_t eliminatePointwiseConstraints() const
Returns true iff handleConstraints will eliminate pointwise constraints (typically vertex values) ...
Definition: gsPrimalSystem.h:284
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
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
gsSparseVector< T > SparseVector
Sparse vector type.
Definition: gsPrimalSystem.h:93
gsPrimalSystem(index_t nPrimalDofs)
Constructor.
Definition: gsPrimalSystem.hpp:20
Simple abstract class for discrete operators.
Definition: gsLinearOperator.h:28
SparseMatrix & localMatrix()
Returns the local stiffness matrix for the primal problem.
Definition: gsPrimalSystem.h:273
bool m_eliminatePointwiseConstraints
handleConstraints will eliminate pointwise constraints
Definition: gsPrimalSystem.h:295
std::vector< OpPtr > m_embeddings
For each patch, the map to .
Definition: gsPrimalSystem.h:294
gsSparseMatrix< T > SparseMatrix
Sparse matrix type.
Definition: gsPrimalSystem.h:91
This class represents the primal system for a IETI-DP algorithm.
Definition: gsPrimalSystem.h:86
Sparse vector class, based on gsEigen::SparseVector.
Definition: gsSparseVector.h:34
SparseMatrix m_localMatrix
The overall matrix for the primal problem.
Definition: gsPrimalSystem.h:291
Simple adapter classes to use matrices or linear solvers as gsLinearOperators.
Matrix m_localRhs
The right-hand side for the primal problem.
Definition: gsPrimalSystem.h:292
std::vector< Matrix > distributePrimalSolution(std::vector< Matrix > sol)
Distributes the given solution for K+1 subdomains to the K patches.
Definition: gsPrimalSystem.hpp:232