G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsIetiSystem.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gsSolver/gsMatrixOp.h>
17 
18 namespace gismo
19 {
20 
68 template< typename T >
70 {
72  typedef memory::shared_ptr<Op> OpPtr;
76  typedef memory::shared_ptr<JumpMatrix> JumpMatrixPtr;
77  typedef gsMatrix<T> Matrix;
78 public:
79 
82  void reserve(index_t n);
83 
96 
99  const JumpMatrixPtr& jumpMatrix(index_t k) const { return m_jumpMatrices[k]; }
100 
103  const OpPtr& localMatrixOp(index_t k) const { return m_localMatrixOps[k]; }
104 
106  Matrix& localRhs(index_t k) { return m_localRhs[k]; }
107  const Matrix& localRhs(index_t k) const { return m_localRhs[k]; }
108 
111  const OpPtr& localSolverOp(index_t k) const { return m_localSolverOps[k]; }
112 
117  {
118  GISMO_ASSERT( m_jumpMatrices.size()>0, "gsIetiSystem: Number of Lagrange multipliers "
119  "can only be determined if there are jump matrices.");
120  return m_jumpMatrices[0]->rows();
121  }
122 
128  OpPtr schurComplement() const;
129 
136 
144  std::vector<Matrix> constructSolutionFromLagrangeMultipliers(const Matrix& multipliers) const;
145 
148  OpPtr saddlePointProblem() const;
149 
152  Matrix rhsForSaddlePoint() const;
153 
157  std::vector<Matrix> constructSolutionFromSaddlePoint(const Matrix& x) const;
158 
159 
160 private:
161  void setupSparseLUSolvers() const;
162 
163  std::vector<JumpMatrixPtr> m_jumpMatrices;
164  std::vector<OpPtr> m_localMatrixOps;
165  std::vector<Matrix> m_localRhs;
166  mutable std::vector<OpPtr> m_localSolverOps;
167 };
168 
169 } // namespace gismo
170 
171 #ifndef GISMO_BUILD_LIB
172 #include GISMO_HPP_HEADER(gsIetiSystem.hpp)
173 #endif
std::vector< OpPtr > m_localMatrixOps
Stores the local matrix ops .
Definition: gsIetiSystem.h:164
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
OpPtr & localMatrixOp(index_t k)
Access the local stiffness matrix (as gsLinearOperator)
Definition: gsIetiSystem.h:102
memory::shared_ptr< Op > OpPtr
Shared pointer to linear operator.
Definition: gsIetiSystem.h:72
JumpMatrixPtr & jumpMatrix(index_t k)
Access the jump matrix.
Definition: gsIetiSystem.h:98
std::vector< Matrix > constructSolutionFromSaddlePoint(const Matrix &x) const
Returns the local solutions for the individual subdomains.
Definition: gsIetiSystem.hpp:141
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
index_t nLagrangeMultipliers() const
Returns the number of Lagrange multipliers.
Definition: gsIetiSystem.h:116
std::vector< Matrix > m_localRhs
Stores the local right-hand sides.
Definition: gsIetiSystem.h:165
#define index_t
Definition: gsConfig.h:32
OpPtr & localSolverOp(index_t k)
Access the local solver operator.
Definition: gsIetiSystem.h:110
This class represents a IETI system.
Definition: gsIetiSystem.h:69
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
void setupSparseLUSolvers() const
Setup solvers if not provided by user.
Definition: gsIetiSystem.hpp:50
gsLinearOperator< T > Op
Linear operator.
Definition: gsIetiSystem.h:71
void reserve(index_t n)
Reserves the memory required to store the number of subdomains.
Definition: gsIetiSystem.hpp:23
Matrix & localRhs(index_t k)
Access the local right-hand side.
Definition: gsIetiSystem.h:106
gsMatrixOp< SparseMatrix > SparseMatrixOp
Sparse matrix type as operatpr.
Definition: gsIetiSystem.h:74
std::vector< JumpMatrixPtr > m_jumpMatrices
Stores the jump matrices.
Definition: gsIetiSystem.h:163
std::vector< OpPtr > m_localSolverOps
Stores the local solvers.
Definition: gsIetiSystem.h:166
gsSparseMatrix< T > SparseMatrix
Sparse matrix type.
Definition: gsIetiSystem.h:73
gsSparseMatrix< T, RowMajor > JumpMatrix
Sparse matrix type for jumps.
Definition: gsIetiSystem.h:75
Simple abstract class for discrete operators.
Definition: gsLinearOperator.h:28
void addSubdomain(JumpMatrixPtr jumpMatrix, OpPtr localMatrixOp, Matrix localRhs, OpPtr localSolverOp=OpPtr())
Definition: gsIetiSystem.hpp:32
Simple adapter classes to use matrices or linear solvers as gsLinearOperators.
OpPtr saddlePointProblem() const
Returns gsLinearOperator that represents the IETI problem as saddle point problem.
Definition: gsIetiSystem.hpp:68
gsMatrix< T > Matrix
Matrix type.
Definition: gsIetiSystem.h:77