24class gsVisitorElPoisson
28 gsVisitorElPoisson(
const gsPde<T> & pde_, gsSparseMatrix<T> * elimMatrix =
nullptr)
29 : pde_ptr(static_cast<const gsPoissonPde<T>*>(&pde_)),
30 N(), elimMat(elimMatrix), localStiffening()
33 void initialize(
const gsBasisRefs<T> & basisRefs,
35 const gsOptionList & options,
42 localStiffening = options.getReal(
"LocalStiff");
44 globalIndices.resize(1);
45 blockNumbers.resize(1);
48 inline void evaluate(
const gsBasisRefs<T> & basisRefs,
49 const gsGeometry<T> & geo,
50 const gsMatrix<T> & quNodes)
59 basisRefs.front().evalAllDers_into(quNodes,1,basisValues);
61 basisRefs.front().active_into(quNodes.col(0),localIndices);
62 N = localIndices.rows();
63 pde_ptr->rhs()->eval_into(md.values[0],forceValues);
66 inline void assemble(gsDomainIterator<T> & element,
67 const gsVector<T> & quWeights)
71 localMat.setZero(N,N);
72 localRhs.setZero(N,pde_ptr->numRhs());
73 for (
index_t q = 0; q < quWeights.rows(); ++q)
76 const T weightMatrix = quWeights[q] * pow(md.measure(q),1-localStiffening);
77 const T weightRHS = quWeights[q] * md.measure(q);
78 transformGradients(md,q,basisValues[1],physGrad);
79 localMat.noalias() += weightMatrix * (physGrad.transpose() * physGrad);
80 localRhs.noalias() += weightRHS * basisValues[0].col(q) * forceValues.col(q).transpose();
84 inline void localToGlobal(
const int patchIndex,
85 const std::vector<gsMatrix<T> > & eliminatedDofs,
86 gsSparseSystem<T> & system)
89 system.mapColIndices(localIndices, patchIndex, globalIndices[0], 0);
90 blockNumbers.at(0) = 0;
92 system.pushToMatrix(localMat,globalIndices,eliminatedDofs,blockNumbers,blockNumbers);
93 system.pushToRhs(localRhs,globalIndices,blockNumbers);
96 if (elimMat !=
nullptr)
100 if (system.colMapper(0).is_free_index(globalIndices[0].at(i)))
102 system.mapToGlobalRowIndex(localIndices.at(i),patchIndex,globalI,0);
103 for (
index_t j = 0; j < N; ++j)
104 if (!system.colMapper(0).is_free_index(globalIndices[0].at(j)))
106 globalElimJ = system.colMapper(0).global_to_bindex(globalIndices[0].at(j));
107 elimMat->coeffRef(globalI,globalElimJ) += localMat(i,j);
116 const gsPoissonPde<T> * pde_ptr;
118 gsMatrix<T> localMat;
119 gsMatrix<T> localRhs;
121 gsMatrix<index_t> localIndices;
125 std::vector<gsMatrix<T> >basisValues;
127 gsMatrix<T> forceValues;
129 gsSparseMatrix<T> * elimMat;
132 gsMatrix<T> physGrad;
133 real_t localStiffening;
135 std::vector< gsMatrix<index_t> > globalIndices;
136 gsVector<index_t> blockNumbers;
#define index_t
Definition gsConfig.h:32
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
This object is a cache for computed values from an evaluator.
Creates a variety of quadrature rules.
The G+Smo namespace, containing all definitions for the library.
@ NEED_VALUE
Value of the object.
Definition gsForwardDeclarations.h:72
@ NEED_GRAD_TRANSFORM
Gradient transformation matrix.
Definition gsForwardDeclarations.h:77
@ NEED_MEASURE
The density of the measure pull back.
Definition gsForwardDeclarations.h:76
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:51