G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsIetiMapper.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gsCore/gsMultiBasis.h>
18 
19 namespace gismo
20 {
21 
48 template< typename T >
50 {
51  typedef gsMatrix<T> Matrix;
54 
55 public:
58 
69  const Matrix& fixedPart
70  )
71  { init(multiBasis, give(dofMapperGlobal), fixedPart); }
72 
80  void init(
83  const Matrix& fixedPart
84  );
85 
87  void cornersAsPrimals();
88 
100  void interfaceAveragesAsPrimals( const gsMultiPatch<T>& geo, short_t d );
101 
107  void customPrimalConstraints( std::vector< std::pair<index_t,SparseVector> > data );
108 
115  void computeJumpMatrices( bool fullyRedundant, bool excludeCorners );
116 
120  std::vector<index_t> skeletonDofs( index_t patch ) const;
121 
131  {
133  "gsIetiMapper: The class has not been initialized." );
134  GISMO_ASSERT( u.mapper().size() == m_dofMapperLocal[k].size(),
135  "gsIetiMapper::initFeSpace: The sizes do not agree." );
136  const_cast<expr::gsFeSpace<T>&>(u).mapper() = m_dofMapperLocal[k];
137  const_cast<expr::gsFeSpace<T>&>(u).fixedPart() = m_fixedPart[k];
138  }
139 
141  Matrix constructGlobalSolutionFromLocalSolutions( const std::vector<Matrix>& localContribs );
142 
143 public:
144 
147  {
148  GISMO_ASSERT(! m_jumpMatrices.empty(),
149  "gsIetiMapper: Number of Lagrange multipliers not yet known.");
150  return m_jumpMatrices[0].rows();
151  }
152 
154  index_t nPrimalDofs() const { return m_nPrimalDofs; }
155 
160  const std::vector<SparseVector> & primalConstraints(index_t k) const { return m_primalConstraints[k]; }
161 
164  const std::vector<index_t> & primalDofIndices(index_t k) const { return m_primalDofIndices[k]; }
165 
168  const JumpMatrix& jumpMatrix(index_t k) const { return m_jumpMatrices[k]; }
169 
171  const gsDofMapper& dofMapperGlobal() const { return m_dofMapperGlobal; }
172 
175  const gsDofMapper& dofMapperLocal(index_t k) const { return m_dofMapperLocal[k]; }
176 
179  const Matrix& fixedPart(index_t k) const { return m_fixedPart[k]; }
180 
183  Matrix incorporateFixedPart(index_t k, const gsMatrix<T>& localSolution) const;
184 
186  const gsMultiBasis<T>& multiBasis() const { return *m_multiBasis; }
187 
188 private:
189 
191  const gsBasis<T>& basis, const gsDofMapper& dm,
192  boxComponent bc );
193 
194 private:
197  std::vector<gsDofMapper> m_dofMapperLocal;
198  std::vector<Matrix> m_fixedPart;
199  std::vector<JumpMatrix> m_jumpMatrices;
201  std::vector< std::vector<SparseVector> > m_primalConstraints;
202  std::vector< std::vector<index_t> > m_primalDofIndices;
203  unsigned m_status;
204 };
205 
206 } // namespace gismo
207 
208 #ifndef GISMO_BUILD_LIB
209 #include GISMO_HPP_HEADER(gsIetiMapper.hpp)
210 #endif
void cornersAsPrimals()
Set up the corners as primal dofs.
Definition: gsIetiMapper.hpp:125
const std::vector< index_t > & primalDofIndices(index_t k) const
Returns the indices of the primal dofs that are associated to the primal constraints for the given pa...
Definition: gsIetiMapper.h:164
Abstract base class representing a geometry map.
Definition: gsGeometry.h:92
Ieti Mapper.
Definition: gsIetiMapper.h:49
gsMatrix< T > Matrix
Matrix type.
Definition: gsIetiMapper.h:51
gsSparseMatrix< T, RowMajor > JumpMatrix
Sparse matrix type for jumps.
Definition: gsIetiMapper.h:53
index_t m_nPrimalDofs
The number of primal dofs already created.
Definition: gsIetiMapper.h:200
#define short_t
Definition: gsConfig.h:35
std::vector< JumpMatrix > m_jumpMatrices
The jump matrices.
Definition: gsIetiMapper.h:199
Provides declaration of MultiBasis class.
const gsDofMapper & dofMapperGlobal() const
The global dof mapper.
Definition: gsIetiMapper.h:171
gsIetiMapper(const gsMultiBasis< T > &multiBasis, gsDofMapper dofMapperGlobal, const Matrix &fixedPart)
Create the ieti mapper.
Definition: gsIetiMapper.h:66
S give(S &x)
Definition: gsMemory.h:266
unsigned m_status
A status flag that is checked by assertions.
Definition: gsIetiMapper.h:203
#define index_t
Definition: gsConfig.h:32
void init(const gsMultiBasis< T > &multiBasis, gsDofMapper dofMapperGlobal, const Matrix &fixedPart)
Init the ieti mapper after default construction.
Definition: gsIetiMapper.hpp:29
const gsMultiBasis< T > & multiBasis() const
Reference to the multi basis object being passed to constructur or init.
Definition: gsIetiMapper.h:186
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
void computeJumpMatrices(bool fullyRedundant, bool excludeCorners)
This function computes the jump matrices.
Definition: gsIetiMapper.hpp:296
Maintains a mapping from patch-local dofs to global dof indices and allows the elimination of individ...
Definition: gsDofMapper.h:68
void customPrimalConstraints(std::vector< std::pair< index_t, SparseVector > > data)
With this function, the caller can register more primal constraints.
Definition: gsIetiMapper.hpp:266
index_t nPrimalDofs() const
Returns the size of the primal problem (number of primal dofs)
Definition: gsIetiMapper.h:154
Holds a set of patch-wise bases and their topology information.
Definition: gsMultiBasis.h:36
const JumpMatrix & jumpMatrix(index_t k) const
Returns the jump matrix for the given patch Only available after computeJumpMatrices has been called...
Definition: gsIetiMapper.h:168
const std::vector< SparseVector > & primalConstraints(index_t k) const
Returns the primalConstraints (as vectors) for the given patch.
Definition: gsIetiMapper.h:160
const Matrix & fixedPart(index_t k) const
The function values for the eliminated dofs on the given patch Only available after computeJumpMatric...
Definition: gsIetiMapper.h:179
std::vector< std::vector< index_t > > m_primalDofIndices
The primal dof indices for each of the primal constraints.
Definition: gsIetiMapper.h:202
Definition: gsDirichletValues.h:23
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
const gsMultiBasis< T > * m_multiBasis
Pointer to the respective multibasis.
Definition: gsIetiMapper.h:195
gsSparseVector< T > SparseVector
Sparse matrix type.
Definition: gsIetiMapper.h:52
gsIetiMapper()
Default constructor.
Definition: gsIetiMapper.h:57
Matrix incorporateFixedPart(index_t k, const gsMatrix< T > &localSolution) const
Incorporates fixedPart (eg. from eliminated Dirichlet dofs) to given patch-local solution.
Definition: gsIetiMapper.hpp:399
void interfaceAveragesAsPrimals(const gsMultiPatch< T > &geo, short_t d)
Set up interface averages as primal dofs.
Definition: gsIetiMapper.hpp:217
Matrix constructGlobalSolutionFromLocalSolutions(const std::vector< Matrix > &localContribs)
Construct the global solution from a vector of patch-local ones.
Definition: gsIetiMapper.hpp:90
index_t size() const
Returns the total number of dofs (free and eliminated).
Definition: gsDofMapper.h:421
std::vector< std::vector< SparseVector > > m_primalConstraints
The primal constraints.
Definition: gsIetiMapper.h:201
void initFeSpace(typename gsExprAssembler< T >::space u, index_t k)
Apply the required changes to a space object of the expression assembler.
Definition: gsIetiMapper.h:130
std::vector< index_t > skeletonDofs(index_t patch) const
Returns a list of dofs that are (on the coarse level) coupled.
Definition: gsIetiMapper.hpp:281
const gsDofMapper & dofMapperLocal(index_t k) const
The dof mapper for the given patch Only available after computeJumpMatrices has been called...
Definition: gsIetiMapper.h:175
std::vector< gsDofMapper > m_dofMapperLocal
A vector of the patch-local dof mappers.
Definition: gsIetiMapper.h:197
static gsSparseVector< T > assembleAverage(const gsGeometry< T > &geo, const gsBasis< T > &basis, const gsDofMapper &dm, boxComponent bc)
Assembles for interfaceAveragesAsPrimals.
Definition: gsIetiMapper.hpp:182
Sparse vector class, based on gsEigen::SparseVector.
Definition: gsSparseVector.h:34
std::vector< Matrix > m_fixedPart
The values for the elminated (Dirichlet) dofs.
Definition: gsIetiMapper.h:198
Generic expressions matrix assembly.
gsDofMapper m_dofMapperGlobal
The global dof mapper.
Definition: gsIetiMapper.h:196
index_t nLagrangeMultipliers()
Returns the number of Lagrange multipliers.
Definition: gsIetiMapper.h:146
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78
Struct which represents a certain component (interior, face, egde, corner).
Definition: gsBoundary.h:445