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

Function InterpolateCF

comp/interpolate.cpp:882–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

880 }
881
882 shared_ptr<CoefficientFunction> InterpolateCF (shared_ptr<CoefficientFunction> func, shared_ptr<FESpace> space,
883 int bonus_intorder,
884 optional<string> opname)
885 {
886 // func->PrintReport(cout);
887
888 if (func->IsZeroCF())
889 return func;
890
891 bool has_trial = false, has_test = false;
892 VorB vb = VOL;
893
894 func->TraverseTree
895 ( [&] (CoefficientFunction & nodecf)
896 {
897
898 if (auto proxy = dynamic_cast<ProxyFunction*> (&nodecf))
899 {
900 if (proxy->IsTestFunction())
901 {
902 // if e.g. H1 without Trace is combined with space where Trace is mandatory
903 if(opname.has_value())
904 vb = max(proxy->GetAdditionalEvaluator(*opname)->VB(),vb);
905 else
906 vb = max(proxy->Evaluator()->VB(),vb);
907 has_test = true;
908 }
909 else
910 {
911 if(opname.has_value())
912 vb = max(proxy->GetAdditionalEvaluator(*opname)->VB(),vb);
913 else
914 vb = max(proxy->Evaluator()->VB(),vb);
915 has_trial = true;
916 }
917 }
918 });
919
920 if (has_trial != has_test)
921 {
922 if (opname.has_value())
923 return make_shared<InterpolateProxy>(
924 func, space, has_test, space->GetAdditionalEvaluators()[*opname],
925 bonus_intorder, vb);
926 else
927 return make_shared<InterpolateProxy>(func, space, has_test,
928 space->GetEvaluator(vb),
929 bonus_intorder, vb);
930 }
931 return make_shared<InterpolationCoefficientFunction> (func, space, bonus_intorder, opname);
932 }
933
934}

Callers 2

DiffMethod · 0.85

Calls 4

IsZeroCFMethod · 0.45
TraverseTreeMethod · 0.45
VBMethod · 0.45

Tested by

no test coverage detected