29 GISMO_ENSURE(unknowns.rows() > 0,
"No unknowns provided!");
30 index_t nRhs = m_system.rhs().cols();
32 for (
size_t p = 0; p < m_pde_ptr->domain().nPatches(); ++p)
34 index_t size = m_bases[unknowns[0]][p].size();
36 for (
index_t i = 1; i < unknowns.rows(); ++i)
38 GISMO_ENSURE(m_bases[unknowns[i]][p].size() == size,
"Unknowns do not have the same size!");
41 for (
index_t unk = 0; unk < unknowns.rows(); ++unk)
42 for (
index_t i = 0; i < size; ++i)
43 if (m_system.colMapper(unknowns[unk]).is_free(i,p))
45 m_system.mapToGlobalColIndex(i,p,idx,unknowns[unk]);
46 coeffs.block(i,unk*nRhs,1,nRhs) = solVector.block(idx,0,1,nRhs);
50 idx = m_system.colMapper(unknowns[unk]).bindex(i, p);
51 coeffs.block(i,unk*nRhs,1,nRhs) = fixedDoFs[unknowns[unk]].block(idx,0,1,nRhs);
53 result.
addPatch(m_bases[unknowns[0]][p].makeGeometry(
give(coeffs)));
63 bool dirBcExists =
false;
64 typename gsBoundaryConditions<T>::const_iterator it = m_pde_ptr->bc().dirichletBegin();
65 while (!dirBcExists && it != m_pde_ptr->bc().
dirichletEnd())
67 if (it->patch() == patch && it->side() == side)
72 +
" does not belong to the Dirichlet boundary.");
76 "Wrong size of a given matrix with Dirichlet DoFs: " +
util::to_string(ddofs.rows()) +
82 m_system.mapColIndices(localBIndices, patch, globalIndices, 0);
83 for (
index_t i = 0; i < globalIndices.rows(); ++i)
84 m_ddof[0].row(m_system.colMapper(0).global_to_bindex(globalIndices(i,0))) = ddofs.row(i);
89 for (
short_t d = 0; d < ddofs.cols(); ++d )
91 m_system.mapColIndices(localBIndices, patch, globalIndices, d);
92 for (
index_t i = 0; i < globalIndices.rows(); ++i)
93 m_ddof[d](m_system.colMapper(d).global_to_bindex(globalIndices(i,0)),0) = ddofs(i,d);
108 m_ddof[d] = ddofs[d];
115 bool dirBcExists =
false;
116 typename gsBoundaryConditions<T>::const_iterator it = m_pde_ptr->bc().dirichletBegin();
117 while (!dirBcExists && it != m_pde_ptr->bc().
dirichletEnd())
119 if (it->patch() == patch && it->side() == side)
124 +
" does not belong to the Dirichlet boundary.");
126 short_t m_dim = m_pde_ptr->domain().targetDim();
129 ddofs.resize(localBIndices.rows(),m_dim);
131 for (
short_t d = 0; d < m_dim; ++d )
133 m_system.mapColIndices(localBIndices, patch, globalIndices, d);
135 for (
index_t i = 0; i < globalIndices.rows(); ++i)
136 ddofs(i,d) = m_ddof[d](m_system.colMapper(d).global_to_bindex(globalIndices(i,0)),0);
145 for (
size_t i = 0; i < m_ddof.size(); ++i)
146 nFixedDofs += m_ddof[i].rows();
154 gsMatrix<T> fixedDofs(numFixedDofs(),m_system.rhs().cols());
157 for (
size_t i = 0; i < m_ddof.size(); ++i)
159 fixedDofs.middleRows(nFixedDofs,m_ddof[i].rows()) = m_ddof[i];
160 nFixedDofs += m_ddof[i].rows();
163 m_system.rhs() = rhsWithZeroDDofs - eliminationMatrix*fixedDofs;
index_t addPatch(typename gsGeometry< T >::uPtr g)
Add a patch from a gsGeometry<T>::uPtr.
Definition: gsMultiPatch.hpp:210
void clear()
Clear (delete) all patches.
Definition: gsMultiPatch.h:319
#define short_t
Definition: gsConfig.h:35
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
std::string to_string(const C &value)
Converts value to string, assuming "operator<<" defined on C.
Definition: gsUtils.h:56
S give(S &x)
Definition: gsMemory.h:266
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
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
virtual void getFixedDofs(index_t patch, boxSide side, gsMatrix< T > &ddofs) const
Definition: gsBaseAssembler.hpp:113
Base class for assemblers of gsElasticity.
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
Struct which represents a certain side of a box.
Definition: gsBoundary.h:84
virtual index_t numFixedDofs() const
get the size of the Dirichlet vector for elimination
Definition: gsBaseAssembler.hpp:142
const_iterator dirichletEnd() const
Definition: gsBoundaryConditions.h:495