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

Method GetComponent

comp/gridfunction.cpp:475–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473
474
475 shared_ptr<GridFunction> GridFunction ::
476 GetComponent (int compound_comp)
477 {
478 auto compfes = dynamic_pointer_cast<CompoundFESpace>(fespace);
479 if(compfes)
480 {
481 if (compound_comp >= compfes->GetNSpaces())
482 throw Exception("GetComponent: compound_comp does not exist!");
483 shared_ptr<GridFunction> sptr;
484 if(compgfs[compound_comp].expired())
485 {
486 sptr = make_shared<ComponentGridFunction>(dynamic_pointer_cast<GridFunction>(this->shared_from_this()),
487 compound_comp);
488 compgfs[compound_comp] = sptr;
489 sptr->Update();
490 }
491 else
492 sptr = compgfs[compound_comp].lock();
493 return sptr;
494 }
495 throw Exception("GetComponent: Not a GridFunction on a Compound FESpace!");
496 }
497
498 shared_ptr<CoefficientFunction>
499 GridFunctionCoefficientFunction :: Primary () const

Callers

nothing calls this directly

Calls 2

shared_from_thisMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected