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

Method CalcDShape

comp/globalinterfacespace.cpp:265–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263 }
264
265 void CalcDShape(const BaseMappedIntegrationPoint& mip,
266 BareSliceMatrix<double, ColMajor> dshapes) const
267 {
268 int order = fes->order;
269 if constexpr(DIM == 1)
270 {
271 double phi = fes->mapping->Evaluate(mip);
272 if(fes->periodic[0])
273 {
274 throw Exception("CalcDShape not implemented for periodic!");
275 }
276 else
277 {
278 AutoDiff<1> adphi(phi, 0);
279 LegendrePolynomial (order, 2*adphi - 1,
280 SBLambda([&](int i, auto val)
281 {
282 dshapes(0,i) = val.DValue(0);
283 }));
284 }
285 }
286 else // DIM == 2
287 {
288 Vec<2, double> phi;
289 fes->mapping->Evaluate(mip, FlatVector<double>(2, phi.Data()));
290 Vec<2, AutoDiff<1>> adphi;
291 adphi[0] = AutoDiff<1>(phi[0], 0);
292 adphi[1] = AutoDiff<1>(phi[1], 0);
293 if (fes->polar) {
294 throw Exception("CalcDShape not implemented for polar!");
295 }
296 else
297 {
298 int ndof1 = fes->periodic[0] ? 2*order+1 : order+1;
299 int ndof2 = fes->periodic[1] ? 2*order+1 : order+1;
300 ArrayMem<double, 20> shapeu(ndof1), shapev(ndof2);
301 ArrayMem<double, 20> dshapeu(ndof1), dshapev(ndof2);
302
303 if(fes->periodic[0])
304 {
305 throw Exception("CalcDShape not implemented for periodic!");
306 }
307 else
308 {
309 LegendrePolynomial(order, -1 + 2 * adphi[0],
310 SBLambda([&](int i, auto val)
311 {
312 shapeu[i] = val.Value();
313 dshapeu[i] = val.DValue(0);
314 }));
315 }
316
317 if(fes->periodic[1])
318 {
319 throw Exception("CalcDShape not implemented for periodic!");
320 }
321 else
322 {

Callers 1

CalcMatrixMethod · 0.45

Calls 6

LegendrePolynomialFunction · 0.85
RangeFunction · 0.50
EvaluateMethod · 0.45
DataMethod · 0.45
ValueMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected