MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / GenerateMatrix

Method GenerateMatrix

comp/hdivdivsurfacespace.cpp:177–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175
176 template <typename AFEL, typename MIP, typename MAT>
177 static void GenerateMatrix (const AFEL & bfel, const MIP & sip,
178 MAT && mat, LocalHeap & lh)
179 {
180 HeapReset hr(lh);
181 const HDivDivFiniteElement<2> & fel =
182 dynamic_cast<const HDivDivFiniteElement<2>&> (bfel);
183
184 int nd = fel.GetNDof();
185
186 Mat<3,2> jac = sip.GetJacobian();
187 double det = fabs (sip.GetJacobiDet());
188
189 FlatMatrix<> shape(nd, 3, lh);
190 fel.CalcShape (sip.IP(), shape);
191
192 Mat<3,9> trans;
193 for (int i = 0; i < 3; i++)
194 {
195 Mat<2> sigma_ref;
196 sigma_ref = 0.0;
197 switch (i)
198 {
199 case 0: sigma_ref(0,0) = 1.0; break;
200 case 1: sigma_ref(1,1) = 1.0; break;
201 case 2: sigma_ref(0,1) = sigma_ref(1,0) = 1.0; break;
202 }
203 auto hm = jac * sigma_ref;
204 auto sigma = hm * Trans(jac);
205 sigma *= (1.0 / sqr(det));
206
207 trans ( i, 0 ) = sigma(0,0);
208 trans ( i, 1 ) = sigma(0,1);
209 trans ( i, 2 ) = sigma(0,2);
210 trans ( i, 3 ) = sigma(1,0);
211 trans ( i, 4 ) = sigma(1,1);
212 trans ( i, 5 ) = sigma(1,2);
213 trans ( i, 6 ) = sigma(2,0);
214 trans ( i, 7 ) = sigma(2,1);
215 trans ( i, 8 ) = sigma(2,2);
216 }
217 mat = Trans(trans) * Trans (shape);
218 }
219
220 static void GenerateMatrixSIMDIR (const FiniteElement & fel,
221 const SIMD_BaseMappedIntegrationRule & mir,

Callers

nothing calls this directly

Calls 6

fabsFunction · 0.85
GetJacobianMethod · 0.80
TransFunction · 0.50
GetNDofMethod · 0.45
GetJacobiDetMethod · 0.45
CalcShapeMethod · 0.45

Tested by

no test coverage detected