24 class gsVisitorElPoisson
28 gsVisitorElPoisson(
const gsPde<T> & pde_, gsSparseMatrix<T> * elimMatrix =
nullptr)
29 : pde_ptr(static_cast<const gsPoissonPde<T>*>(&pde_)),
33 void initialize(
const gsBasisRefs<T> & basisRefs,
35 const gsOptionList & options,
41 localStiffening = options.getReal(
"LocalStiff");
43 globalIndices.resize(1);
44 blockNumbers.resize(1);
47 inline void evaluate(
const gsBasisRefs<T> & basisRefs,
48 const gsGeometry<T> & geo,
49 const gsMatrix<T> & quNodes)
58 basisRefs.front().evalAllDers_into(quNodes,1,basisValues);
60 basisRefs.front().active_into(quNodes.col(0),localIndices);
61 N = localIndices.rows();
62 pde_ptr->rhs()->eval_into(md.values[0],forceValues);
65 inline void assemble(gsDomainIterator<T> & element,
66 const gsVector<T> & quWeights)
69 localMat.setZero(N,N);
70 localRhs.setZero(N,pde_ptr->numRhs());
71 for (
index_t q = 0; q < quWeights.rows(); ++q)
74 const T weightMatrix = quWeights[q] * pow(md.measure(q),1-localStiffening);
75 const T weightRHS = quWeights[q] * md.measure(q);
76 transformGradients(md,q,basisValues[1],physGrad);
77 localMat.noalias() += weightMatrix * (physGrad.transpose() * physGrad);
78 localRhs.noalias() += weightRHS * basisValues[0].col(q) * forceValues.col(q).transpose();
82 inline void localToGlobal(
const int patchIndex,
83 const std::vector<gsMatrix<T> > & eliminatedDofs,
84 gsSparseSystem<T> & system)
87 system.mapColIndices(localIndices, patchIndex, globalIndices[0], 0);
88 blockNumbers.at(0) = 0;
90 system.pushToMatrix(localMat,globalIndices,eliminatedDofs,blockNumbers,blockNumbers);
91 system.pushToRhs(localRhs,globalIndices,blockNumbers);
94 if (elimMat !=
nullptr)
98 if (system.colMapper(0).is_free_index(globalIndices[0].at(i)))
100 system.mapToGlobalRowIndex(localIndices.at(i),patchIndex,globalI,0);
101 for (
index_t j = 0; j < N; ++j)
102 if (!system.colMapper(0).is_free_index(globalIndices[0].at(j)))
104 globalElimJ = system.colMapper(0).global_to_bindex(globalIndices[0].at(j));
105 elimMat->coeffRef(globalI,globalElimJ) += localMat(i,j);
114 const gsPoissonPde<T> * pde_ptr;
116 gsMatrix<T> localMat;
117 gsMatrix<T> localRhs;
119 gsMatrix<index_t> localIndices;
123 std::vector<gsMatrix<T> >basisValues;
125 gsMatrix<T> forceValues;
127 gsSparseMatrix<T> * elimMat;
130 gsMatrix<T> physGrad;
131 real_t localStiffening;
133 std::vector< gsMatrix<index_t> > globalIndices;
134 gsVector<index_t> blockNumbers;
#define index_t
Definition: gsConfig.h:32
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
Creates a variety of quadrature rules.
The density of the measure pull back.
Definition: gsForwardDeclarations.h:76
Value of the object.
Definition: gsForwardDeclarations.h:72
Gradient transformation matrix.
Definition: gsForwardDeclarations.h:77
This object is a cache for computed values from an evaluator.