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

Method DiffShape

fem/diffop_hesse.cpp:7–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5{
6 template <int D>
7 shared_ptr<CoefficientFunction>
8 DiffOpHesse<D>::
9 DiffShape (shared_ptr<CoefficientFunction> proxy,
10 shared_ptr<CoefficientFunction> dir,
11 bool eulerian)
12 {
13 if(eulerian)
14 throw Exception("DiffShape Eulerian not implemented for Hesse!");
15
16 auto grad_proxy = proxy->Primary()->Operator("Grad")->Reshape(Array<int>{-1,D});
17 auto hesse_grad_dir = proxy->Reshape(Array<int>({-1,D})) * dir->Operator("Grad");
18 const auto& shape = proxy->Dimensions();
19 return - (grad_proxy * dir->Operator("hesse")->Reshape(Array<int>{D,-1}))->Reshape(shape)
20 - hesse_grad_dir->Reshape(Array<int>{-1,D,D})->TensorTranspose(1,2)->Reshape(shape)
21 - hesse_grad_dir->Reshape(shape);
22 };
23
24 template <int D, typename FEL>
25 shared_ptr<CoefficientFunction>

Callers

nothing calls this directly

Calls 5

TransposeCFFunction · 0.85
NormalVectorCFFunction · 0.85
IdentityCFFunction · 0.85
DimensionsMethod · 0.80
OperatorMethod · 0.45

Tested by

no test coverage detected