G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsGenericAssembler.h
Go to the documentation of this file.
1
14#pragma once
15
17#include <gsPde/gsLaplacePde.h>
18
22
23namespace gismo
24{
25
31template <class T>
33{
34public:
35 typedef gsAssembler<T> Base;
36
37public:
38
41
49 const gsMultiBasis<T> & bases,
50 const gsOptionList & opt = defaultOptions(),
51 const gsBoundaryConditions<T> * bc = NULL)
52 : m_pde(patches)
53 {
54 if ( bc != NULL)
55 {
56 m_pde.boundaryConditions() = *bc;
57 this->m_ddof.resize(1);
58 }
59
60 Base::initialize(m_pde, bases, opt);
62 }
63
64 /* TODO (id geometry)
65 // Constructor with gsMultiBasis
66 gsGenericAssembler( gsMultiBasis<T> const & bases,
67 bool conforming = false,
68 const gsBoundaryConditions<T> * bc = NULL)
69 : Base(patches)
70 {
71 m_bases.push_back(bases);
72
73 Base::initialize(m_pde, bases, opt);
74 gsGenericAssembler::refresh();
75 }
76 */
77
79 void refresh()
80 {
81 // Setup sparse system
82 gsDofMapper mapper;
83 m_bases[0].getMapper(
84 (dirichlet::strategy)(m_options.getInt("DirichletStrategy")),
85 (iFace::strategy)(m_options.getInt("InterfaceStrategy")),
86 this->pde().bc(), mapper, 0);
88 //note: no allocation here
89 // const index_t nz = m_options.numColNz(m_bases[0][0]);
90 // m_system.reserve(nz, 1);
91 }
92
94 void refresh(gsDofMapper mapper)
95 {
97 }
98
103 const gsSparseMatrix<T> & assembleMass(const index_t patchIndex = -1, bool refresh = true);
104
109 {
110 typedef typename gsExprAssembler<T>::geometryMap geometryMap;
111 typedef typename gsExprAssembler<T>::space space;
112
113 // Elements used for numerical integration
114 gsExprAssembler<T> A(1,1);
116 geometryMap G = A.getMap(m_pde_ptr->patches());
117 space u = A.getSpace(m_bases.front());
118
119 A.initSystem();
120 //m_system.matrix() = A.assemble( u * u.tr() * meas(G) );
121 A.assemble( u * u.tr() * meas(G) );
122 m_system.matrix() = A.matrix();
123
124 return m_system.matrix();
125 }
126
131 const gsSparseMatrix<T> & assembleStiffness(const index_t patchIndex = -1, const bool refresh = true);
132
138 const gsMatrix<T> & assembleMoments(const gsFunction<T> & func, index_t patchIndex = -1, bool refresh = true);
139
145 const gsSparseMatrix<T> & assembleDG(const boundaryInterface & iFace, bool refresh = true);
146
151 const gsSparseMatrix<T> & assembleNeumann(const boundary_condition<T> & bc, bool refresh = true);
152
159 const gsSparseMatrix<T> & assembleNitsche(const boundary_condition<T> & bc, bool refresh = true);
160
167 {
168 return m_system.matrix().template selfadjointView<Lower>();
169 }
170
177 {
178 return m_system.matrix().template selfadjointView<Lower>();
179 }
180
181
182private:
183
184 // Members from gsAssembler
185 using Base::m_pde_ptr;
186 using Base::m_bases;
187 using Base::m_ddof;
188 using Base::m_options;
189 using Base::m_system;
190
191private:
192
193 gsLaplacePde<T> m_pde;
194};
195
196
197
198} // namespace gismo
199
200#ifndef GISMO_BUILD_LIB
201#include GISMO_HPP_HEADER(gsGenericAssembler.hpp)
202#endif
Definition gsExpressions.h:973
The assembler class provides generic routines for volume and boundary integrals that are used for for...
Definition gsAssembler.h:266
void initialize(const gsPde< T > &pde, const gsStdVectorRef< gsMultiBasis< T > > &bases, const gsOptionList &opt=defaultOptions())
Intitialize function for, sets data fields using the pde, a vector of multi-basis and assembler optio...
Definition gsAssembler.h:317
gsSparseSystem< T > m_system
Global sparse linear system.
Definition gsAssembler.h:290
std::vector< gsMultiBasis< T > > m_bases
Definition gsAssembler.h:282
gsOptionList m_options
Options.
Definition gsAssembler.h:285
memory::shared_ptr< gsPde< T > > m_pde_ptr
Definition gsAssembler.h:276
std::vector< gsMatrix< T > > m_ddof
Definition gsAssembler.h:295
const gsMultiPatch< T > & patches() const
Return the multipatch.
Definition gsAssembler.h:601
Class containing a set of boundary conditions.
Definition gsBoundaryConditions.h:342
Maintains a mapping from patch-local dofs to global dof indices and allows the elimination of individ...
Definition gsDofMapper.h:69
Definition gsExprAssembler.h:33
void setIntegrationElements(const gsMultiBasis< T > &mesh)
Sets the domain of integration.
Definition gsExprAssembler.h:161
gsExprHelper< T >::geometryMap geometryMap
Geometry map type.
Definition gsExprAssembler.h:65
space getSpace(const gsFunctionSet< T > &mp, index_t dim=1, index_t id=0)
Definition gsExprAssembler.h:191
geometryMap getMap(const gsFunctionSet< T > &g)
Registers g as an isogeometric geometry map and return a handle to it.
Definition gsExprAssembler.h:186
void initSystem(const index_t numRhs=1)
Initializes the sparse system (sparse matrix and rhs)
Definition gsExprAssembler.h:315
void assemble(const expr &... args)
Adds the expressions args to the system matrix/rhs The arguments are considered as integrals over the...
Definition gsExprAssembler.h:1077
const gsSparseMatrix< T > & matrix() const
Returns the left-hand global matrix.
Definition gsExprAssembler.h:127
A function from a n-dimensional domain to an m-dimensional image.
Definition gsFunction.h:60
Assembles mass and stiffness matrices and right-hand sides on a given domain.
Definition gsGenericAssembler.h:33
const gsMatrix< T > & assembleMoments(const gsFunction< T > &func, index_t patchIndex=-1, bool refresh=true)
Moments assembly routine.
Definition gsGenericAssembler.hpp:93
gsSparseMatrix< T >::fullView fullMatrix()
Returns an expression of the "full" assembled sparse matrix.
Definition gsGenericAssembler.h:166
const gsSparseMatrix< T > & assembleDG(const boundaryInterface &iFace, bool refresh=true)
Assemble dG interface terms.
Definition gsGenericAssembler.hpp:116
const gsSparseMatrix< T > & assembleNitsche(const boundary_condition< T > &bc, bool refresh=true)
Assemble Nitsche terms for weakly imposing Dirichlet conditions.
Definition gsGenericAssembler.hpp:160
gsSparseSystem< T > m_system
Global sparse linear system.
Definition gsAssembler.h:290
gsGenericAssembler(const gsMultiPatch< T > &patches, const gsMultiBasis< T > &bases, const gsOptionList &opt=defaultOptions(), const gsBoundaryConditions< T > *bc=NULL)
Constructor.
Definition gsGenericAssembler.h:48
void refresh()
Refreshes the sparse system (deletes assembled matrices and vectors)
Definition gsGenericAssembler.h:79
const gsSparseMatrix< T > & assembleStiffness(const index_t patchIndex=-1, const bool refresh=true)
Stiffness assembly routine.
Definition gsGenericAssembler.hpp:65
const gsSparseMatrix< T > & assembleNeumann(const boundary_condition< T > &bc, bool refresh=true)
Assemble Neumann boundary terms.
Definition gsGenericAssembler.hpp:139
const gsSparseMatrix< T >::constFullView fullMatrix() const
Returns an expression of the "full" assembled sparse matrix.
Definition gsGenericAssembler.h:176
const gsSparseMatrix< T > & assembleMass2()
Mass assembly routine.
Definition gsGenericAssembler.h:108
std::vector< gsMultiBasis< T > > m_bases
Definition gsAssembler.h:282
gsOptionList m_options
Options.
Definition gsAssembler.h:285
void refresh(gsDofMapper mapper)
Refreshes the sparse system based on given dof mapper.
Definition gsGenericAssembler.h:94
memory::shared_ptr< gsPde< T > > m_pde_ptr
Definition gsAssembler.h:276
std::vector< gsMatrix< T > > m_ddof
Definition gsAssembler.h:295
static gsOptionList defaultOptions()
Returns the list of default options for assembly.
Definition gsGenericAssembler.hpp:28
const gsSparseMatrix< T > & assembleMass(const index_t patchIndex=-1, bool refresh=true)
Mass assembly routine.
Definition gsGenericAssembler.hpp:37
The Laplace equation.
Definition gsLaplacePde.h:35
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Holds a set of patch-wise bases and their topology information.
Definition gsMultiBasis.h:37
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
const index_t & getInt(const std::string &label) const
Reads value for option label from options.
Definition gsOptionList.cpp:37
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
gsEigen::SparseSelfAdjointView< Base, Lower > fullView
Definition gsSparseMatrix.h:165
gsEigen::SparseSelfAdjointView< const Base, Lower > constFullView
Definition gsSparseMatrix.h:169
A sparse linear system indexed by sets of degrees of freedom.
Definition gsSparseSystem.h:30
const gsSparseMatrix< T > & matrix() const
Access the system Matrix.
Definition gsSparseSystem.h:394
Provides generic assembler routines.
#define index_t
Definition gsConfig.h:32
Generic expressions matrix assembly.
Generic expressions helper.
Defines different expressions.
Describes a Laplace equation.
The G+Smo namespace, containing all definitions for the library.
Struct which represents an interface between two patches.
Definition gsBoundary.h:650
Class that defines a boundary condition for a side of a patch for some unknown variable of a PDE.
Definition gsBoundaryConditions.h:107