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

Function MakeComponentCoefficientFunction

fem/coefficient.cpp:4591–4617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4589
4590
4591shared_ptr<CoefficientFunction>
4592MakeComponentCoefficientFunction (shared_ptr<CoefficientFunction> c1, int comp)
4593{
4594 if (c1->IsZeroCF())
4595 return ZeroCF( Array<int>({}) );
4596
4597 if (c1->GetDescription() == "unary operation ' '" && !c1->IsVariable())
4598 return MakeComponentCoefficientFunction(c1->InputCoefficientFunctions()[0], comp);
4599
4600 if (c1->GetDescription() == "VectorialCoefficientFunction")
4601 {
4602 int ci = 0;
4603 int dim = 0;
4604 auto coefs = c1->InputCoefficientFunctions();
4605 while(dim<=comp)
4606 {
4607 int dim_last = dim;
4608 if(dim == comp && coefs[ci]->Dimension() == 1)
4609 return coefs[ci];
4610 dim += coefs[ci]->Dimension();
4611 if(dim>comp)
4612 return MakeComponentCoefficientFunction( coefs[ci], comp-dim_last );
4613 ci++;
4614 }
4615 }
4616 return make_shared<ComponentCoefficientFunction> (c1, comp);
4617}
4618
4619
4620// ********************** SubTensorCoefficientFunction **********************

Callers 8

DiffShapeMethod · 0.85
DiffMethod · 0.85
DiffJacobiMethod · 0.85
operator*Function · 0.85
InnerProductFunction · 0.85
DiffMethod · 0.85

Calls 5

ZeroCFFunction · 0.85
IsZeroCFMethod · 0.45
GetDescriptionMethod · 0.45
DimensionMethod · 0.45

Tested by

no test coverage detected