G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsBaseAssembler.h
Go to the documentation of this file.
1 
15 #pragma once
16 
18 
19 namespace gismo
20 {
21 
25 template <class T>
26 class gsBaseAssembler : public gsAssembler<T>
27 {
28 public:
29  typedef memory::shared_ptr<gsBaseAssembler> Ptr;
30  typedef memory::unique_ptr<gsBaseAssembler> uPtr;
31 
35  virtual bool assemble(const gsMatrix<T> & solutionVector,
36  const std::vector<gsMatrix<T> > & fixedDDoFs) = 0;
37 
39  virtual void assemble(bool saveEliminationMatrix = false) {};
40 
42  virtual int numDofs() const { return gsAssembler<T>::numDofs(); }
43 
45  virtual void constructSolution(const gsMatrix<T> & solVector,
46  const std::vector<gsMatrix<T> > & fixedDDofs,
47  gsMultiPatch<T> & result,
48  const gsVector<index_t> & unknowns) const;
49 
50  virtual void constructSolution(const gsMatrix<T> & solVector,
51  const std::vector<gsMatrix<T> > & fixedDDofs,
52  gsMultiPatch<T> & result) const {};
53 
54  //--------------------- DIRICHLET BC SHENANIGANS ----------------------------------//
55 
63  virtual void setFixedDofs(index_t patch, boxSide side, const gsMatrix<T> & ddofs, bool oneUnk = false);
64 
66  virtual void setFixedDofs(const std::vector<gsMatrix<T> > & ddofs);
67 
70  virtual void getFixedDofs(index_t patch, boxSide side, gsMatrix<T> & ddofs) const;
71 
73  virtual index_t numFixedDofs() const;
74 
76  virtual void eliminateFixedDofs();
77 
78  //virtual void modifyDirichletDofs(size_t patch, boxSide side, const gsMatrix<T> & ddofs);
79 
80  //--------------------- OTHER ----------------------------------//
81 
82  virtual void setRHS(const gsMatrix<T> & rhs) {m_system.rhs() = rhs;}
83 
84  virtual void setMatrix(const gsSparseMatrix<T> & matrix) {m_system.matrix() = matrix;}
85 
86 protected:
87  using gsAssembler<T>::m_pde_ptr;
88  using gsAssembler<T>::m_bases;
89  using gsAssembler<T>::m_system;
90  using gsAssembler<T>::m_ddof;
91 
92  gsSparseMatrix<T> eliminationMatrix;
93  gsMatrix<T> rhsWithZeroDDofs;
94 };
95 
96 } // namespace ends
97 
98 #ifndef GISMO_BUILD_LIB
99 #include GISMO_HPP_HEADER(gsBaseAssembler.hpp)
100 #endif
Provides generic assembler routines.
virtual void constructSolution(const gsMatrix< T > &solVector, const std::vector< gsMatrix< T > > &fixedDDofs, gsMultiPatch< T > &result, const gsVector< index_t > &unknowns) const
Constructs solution as a gsMultiPatch object from the solution vector and fixed DoFs.
Definition: gsBaseAssembler.hpp:23
virtual void assemble(bool saveEliminationMatrix=false)
assembly procedure for linear problems
Definition: gsBaseAssembler.h:39
const gsMatrix< T > & rhs() const
Returns the left-hand side vector(s) ( multiple right hand sides possible )
Definition: gsAssembler.h:618
#define index_t
Definition: gsConfig.h:32
virtual void setFixedDofs(index_t patch, boxSide side, const gsMatrix< T > &ddofs, bool oneUnk=false)
Set Dirichet degrees of freedom on a given side of a given patch from a given matrix.
Definition: gsBaseAssembler.hpp:61
virtual void eliminateFixedDofs()
Eliminates new Dirichelt degrees of fredom.
Definition: gsBaseAssembler.hpp:151
index_t numDofs() const
Returns the number of (free) degrees of freedom.
Definition: gsAssembler.h:633
const gsSparseMatrix< T > & matrix() const
Access the system Matrix.
Definition: gsSparseSystem.h:394
virtual void getFixedDofs(index_t patch, boxSide side, gsMatrix< T > &ddofs) const
Definition: gsBaseAssembler.hpp:113
virtual int numDofs() const
Returns number of free degrees of freedom.
Definition: gsBaseAssembler.h:42
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
gsSparseSystem< T > m_system
Global sparse linear system.
Definition: gsAssembler.h:290
virtual index_t numFixedDofs() const
get the size of the Dirichlet vector for elimination
Definition: gsBaseAssembler.hpp:142
const gsMatrix< T > & rhs() const
Access the right hand side.
Definition: gsSparseSystem.h:402
virtual void assemble()
Main assemble routine, to be implemented in derived classes.
Definition: gsAssembler.hpp:51
const gsSparseMatrix< T > & matrix() const
Returns the left-hand global matrix.
Definition: gsAssembler.h:614