24 class gsVisitorBiharmonic
29 : pde_ptr(static_cast<const gsPoissonPde<T>*>(&pde_)),
33 void initialize(
const gsBasisRefs<T> & basisRefs,
35 const gsOptionList & options,
42 localStiffening = options.getReal(
"LocalStiff");
44 globalIndices.resize(2);
45 blockNumbers.resize(2);
48 inline void evaluate(
const gsBasisRefs<T> & basisRefs,
49 const gsGeometry<T> & geo,
50 const gsMatrix<T> & quNodes)
61 basisRefs.front().active_into(quNodes.col(0),localIndicesMain);
62 N_M = localIndicesMain.rows();
63 basisRefs.back().active_into(quNodes.col(0), localIndicesAux);
64 N_A = localIndicesAux.rows();
66 basisRefs.front().evalAllDers_into(quNodes,1,basisValuesMain);
67 basisRefs.back().evalAllDers_into(quNodes,1,basisValuesAux);
69 pde_ptr->rhs()->eval_into(md.values[0],forceValues);
72 inline void assemble(gsDomainIterator<T> & element,
73 const gsVector<T> & quWeights)
76 localMat.setZero(N_M + N_A, N_M + N_A);
77 localRhs.setZero(N_M + N_A,pde_ptr->numRhs());
80 for (
index_t q = 0; q < quWeights.rows(); ++q)
83 const T weightMatrix = quWeights[q] * pow(md.measure(q),1-localStiffening);
84 const T weightRHS = quWeights[q] * md.measure(q);
86 transformGradients(md, q, basisValuesAux[1], physGradAux);
87 transformGradients(md, q, basisValuesMain[1], physGradMain);
89 block = weightMatrix * basisValuesAux[0].col(q) * basisValuesAux[0].col(q).transpose();
90 localMat.block(N_M,N_M,N_A,N_A) += block.block(0,0,N_A,N_A);
92 block = weightMatrix * physGradAux.transpose()*physGradMain;
93 localMat.block(0,N_M,N_M,N_A) += block.block(0,0,N_A,N_M).transpose();
94 localMat.block(N_M,0,N_A,N_M) += block.block(0,0,N_A,N_M);
96 localRhs.middleRows(0,N_M).noalias() += weightRHS * basisValuesMain[0].col(q) * forceValues.col(q).transpose();
101 const std::vector<gsMatrix<T> > & eliminatedDofs,
102 gsSparseSystem<T> & system)
105 system.mapColIndices(localIndicesMain,patchIndex,globalIndices[0],0);
106 system.mapColIndices(localIndicesAux,patchIndex,globalIndices[1],1);
107 blockNumbers.
at(0) = 0;
108 blockNumbers.
at(1) = 1;
110 system.pushToRhs(localRhs,globalIndices,blockNumbers);
111 system.pushToMatrix(localMat,globalIndices,eliminatedDofs,blockNumbers,blockNumbers);
114 if (elimMat !=
nullptr)
118 for (
short_t dJ = 0; dJ < 2; ++dJ)
120 for (
short_t dI = 0; dI < 2; ++dI)
121 for (
index_t i = 0; i < N_M; ++i)
122 if (system.colMapper(dI).is_free_index(globalIndices[dI].at(i)))
124 system.mapToGlobalRowIndex(localIndicesMain.
at(i),patchIndex,globalI,dI);
125 for (
index_t j = 0; j < N_M; ++j)
126 if (!system.colMapper(dJ).is_free_index(globalIndices[dJ].at(j)))
128 globalElimJ = system.colMapper(dJ).global_to_bindex(globalIndices[dJ].at(j));
129 elimMat->coeffRef(globalI,elimSize+globalElimJ) += localMat(N_M*dI+i,N_M*dJ+j);
132 elimSize += eliminatedDofs[dJ].rows();
139 const gsPoissonPde<T> * pde_ptr;
143 gsMatrix<T> localMat;
144 gsMatrix<T> localRhs;
146 gsMatrix<index_t> localIndicesMain;
147 gsMatrix<index_t> localIndicesAux;
153 std::vector<gsMatrix<T> > basisValuesMain;
154 std::vector<gsMatrix<T> > basisValuesAux;
156 gsMatrix<T> forceValues;
158 gsMatrix<T> block, physGradMain, physGradAux;
159 real_t localStiffening;
161 gsSparseMatrix<T> * elimMat;
163 std::vector< gsMatrix<index_t> > globalIndices;
164 gsVector<index_t> blockNumbers;
#define short_t
Definition: gsConfig.h:35
#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
void assemble(gsDomainIterator< T > &, const gsVector< T > &quWeights)
Assemble on element.
Definition: gsVisitorBiharmonic.h:109
T at(index_t i) const
Returns the i-th element of the vector.
Definition: gsVector.h:177
Creates a variety of quadrature rules.
void localToGlobal(const index_t patchIndex, const std::vector< gsMatrix< T > > &eliminatedDofs, gsSparseSystem< T > &system)
Adds the contributions to the sparse system.
Definition: gsVisitorBiharmonic.h:132
The density of the measure pull back.
Definition: gsForwardDeclarations.h:76
gsVisitorBiharmonic(const gsPde< T > &pde)
Constructor.
Definition: gsVisitorBiharmonic.h:39
Value of the object.
Definition: gsForwardDeclarations.h:72
void evaluate(const gsBasis< T > &basis, const gsGeometry< T > &geo, gsMatrix< T > &quNodes)
Evaluate on element.
Definition: gsVisitorBiharmonic.h:81
Gradient transformation matrix.
Definition: gsForwardDeclarations.h:77
void initialize(const gsBasis< T > &basis, gsQuadRule< T > &rule)
Initialize.
Definition: gsVisitorBiharmonic.h:53
This object is a cache for computed values from an evaluator.