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

Method DiffJacobi

fem/coefficient.cpp:5105–5129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5103 }
5104
5105 shared_ptr<CoefficientFunction> DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override
5106 {
5107 auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this());
5108 if (cache.find(thisptr) != cache.end())
5109 return cache[thisptr];
5110
5111 if (this == var) return IdentityCF(this->Dimensions());
5112
5113 Array<int> resdims;
5114 resdims += Dimensions();
5115 resdims += var->Dimensions();
5116
5117 Array<int> resstride(resdims.Size());
5118 resstride.Range(0, dims.Size()) = stride;
5119 resstride.Range(dims.Size(), END) = 1;
5120 for (int i = resdims.Size() - 1; i >= dims.Size(); i--)
5121 for (int j = 0; j < i; ++j)
5122 resstride[j] *= resdims[i];
5123
5124// cout << "new stride: " << resstride << endl;
5125 auto diffc1 = c1->DiffJacobi (var, cache);
5126 auto res = MakeExtendDimensionCoefficientFunction (diffc1, std::move(resdims), Array<int>(pos), std::move(resstride));
5127 cache[thisptr] = res;
5128 return res;
5129 }
5130
5131 virtual void NonZeroPattern (const class ProxyUserData & ud,
5132 FlatVector<AutoDiffDiff<1,NonZero>> values) const override

Callers

nothing calls this directly

Calls 10

IdentityCFFunction · 0.85
DimensionsFunction · 0.85
findMethod · 0.80
DimensionsMethod · 0.80
shared_from_thisMethod · 0.45
endMethod · 0.45
SizeMethod · 0.45
RangeMethod · 0.45
DiffJacobiMethod · 0.45

Tested by

no test coverage detected