30 elimMat(elimMatrix) {}
32 void initialize(
const gsBasisRefs<T> & basisRefs,
34 const gsOptionList & options,
38 dim = basisRefs.front().dim();
42 density = options.getReal(
"Density");
44 globalIndices.resize(dim);
45 blockNumbers.resize(dim);
48 inline void evaluate(
const gsBasisRefs<T> & basisRefs,
49 const gsGeometry<T> & geo,
50 const gsMatrix<T> & quNodes)
59 basisRefs.front().eval_into(quNodes,basisValuesDisp);
61 basisRefs.front().active_into(quNodes.col(0),localIndicesDisp);
62 N_D = localIndicesDisp.rows();
66 inline void assemble(gsDomainIterator<T> & element,
67 const gsVector<T> & quWeights)
70 localMat.setZero(dim*N_D,dim*N_D);
71 block = density*basisValuesDisp * quWeights.asDiagonal() * md.measures.asDiagonal() * basisValuesDisp.transpose();
72 for (
short_t d = 0; d < dim; ++d)
73 localMat.block(d*N_D,d*N_D,N_D,N_D) = block.block(0,0,N_D,N_D);
77 const std::vector<gsMatrix<T> > & eliminatedDofs,
78 gsSparseSystem<T> & system)
81 for (
short_t d = 0; d < dim; ++d)
83 system.mapColIndices(localIndicesDisp, patchIndex, globalIndices[d], d);
84 blockNumbers.
at(d) = d;
87 system.pushToMatrix(localMat,globalIndices,eliminatedDofs,blockNumbers,blockNumbers);
90 if (elimMat !=
nullptr)
94 for (
short_t dJ = 0; dJ < dim; ++dJ)
96 for (
short_t dI = 0; dI < dim; ++dI)
97 for (
index_t i = 0; i < N_D; ++i)
98 if (system.colMapper(dI).is_free_index(globalIndices[dI].at(i)))
100 system.mapToGlobalRowIndex(localIndicesDisp.
at(i),patchIndex,globalI,dI);
101 for (
index_t j = 0; j < N_D; ++j)
102 if (!system.colMapper(dJ).is_free_index(globalIndices[dJ].at(j)))
104 globalElimJ = system.colMapper(dJ).global_to_bindex(globalIndices[dJ].at(j));
105 elimMat->coeffRef(globalI,elimSize+globalElimJ) += localMat(N_D*dI+i,N_D*dJ+j);
108 elimSize += eliminatedDofs[dJ].rows();
121 gsMatrix<T> localMat;
123 gsMatrix<index_t> localIndicesDisp;
127 gsMatrix<T> basisValuesDisp;
130 gsSparseMatrix<T> * elimMat;
135 std::vector< gsMatrix<index_t> > globalIndices;
136 gsVector<index_t> blockNumbers;
void assemble(gsDomainIterator< T > &, gsVector< T > const &quWeights)
Assemble on element.
Definition: gsVisitorMass.h:79
#define short_t
Definition: gsConfig.h:35
void evaluate(const gsBasis< T > &basis, const gsGeometry< T > &geo, gsMatrix< T > &quNodes)
Evaluate on element.
Definition: gsVisitorMass.h:57
void initialize(const gsBasis< T > &basis, const index_t, const gsOptionList &options, gsQuadRule< T > &rule)
Initialize.
Definition: gsVisitorMass.h:44
#define index_t
Definition: gsConfig.h:32
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition: gsMatrix.h:211
static gsQuadRule< T > get(const gsBasis< T > &basis, const gsOptionList &options, short_t fixDir=-1)
Constructs a quadrature rule based on input options.
Definition: gsQuadrature.h:48
T at(index_t i) const
Returns the i-th element of the vector.
Definition: gsVector.h:177
Creates a variety of quadrature rules.
The density of the measure pull back.
Definition: gsForwardDeclarations.h:76
void localToGlobal(const index_t patchIndex, const std::vector< gsMatrix< T > > &eliminatedDofs, gsSparseSystem< T > &system)
Adds the contributions to the sparse system.
Definition: gsVisitorMass.h:88
This object is a cache for computed values from an evaluator.
gsVisitorMass()
Constructor.
Definition: gsVisitorMass.h:34