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

Method DiffJacobi

fem/coefficient.cpp:2877–2903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2875
2876
2877 shared_ptr<CoefficientFunction> DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override
2878 {
2879 auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this());
2880 if (cache.find(thisptr) != cache.end())
2881 return cache[thisptr];
2882
2883 if (this == var)
2884 return make_shared<ConstantCoefficientFunction> (1);
2885
2886 shared_ptr<CoefficientFunction> dv1v1;
2887 int dimip = c1->Dimension();
2888 int dimvar = var->Dimension();
2889
2890 auto vc1 = c1->Reshape( dimip );
2891
2892 if (c1.get() == var)
2893 dv1v1 = c1;
2894 else
2895 {
2896 auto dvc1 = c1->DiffJacobi (var, cache);
2897 dv1v1 = dvc1 -> Reshape(dimip, dimvar) -> Transpose() * vc1;
2898 dv1v1 = dv1v1 -> Reshape (var->Dimensions());
2899 }
2900 auto res = 2*dv1v1;
2901 cache[thisptr] = res;
2902 return res;
2903 }
2904
2905
2906 virtual void NonZeroPattern (const class ProxyUserData & ud,

Callers

nothing calls this directly

Calls 7

findMethod · 0.80
DimensionsMethod · 0.80
shared_from_thisMethod · 0.45
endMethod · 0.45
DimensionMethod · 0.45
getMethod · 0.45
DiffJacobiMethod · 0.45

Tested by

no test coverage detected