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

Function is_identity

fem/tensorcoefficient.cpp:511–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509 }
510
511 bool is_identity(const shared_ptr<CoefficientFunction> cf) {
512 if (dynamic_pointer_cast<IdentityCoefficientFunction>(cf))
513 return true;
514
515 if (auto dims = cf->Dimensions(); dims.Size() % 2 == 0
516 && dynamic_pointer_cast<cl_UnaryOpCF<GenericIdentity>>(cf)
517 && is_identity(cf->InputCoefficientFunctions()[0]))
518 {
519 auto N = size_t(dims.Size() / 2);
520 for (auto j : Range(N))
521 if (dims[j] != dims[j + N])
522 return false;
523 return true;
524 }
525
526 return false;
527 }
528
529 pair<string, Array<shared_ptr<CoefficientFunction>>>
530 expand_higher_order_identities(string signature,

Callers 1

Calls 4

DimensionsMethod · 0.80
RangeFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected