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

Method Apply

comp/interpolate.cpp:645–702  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

643
644
645 void Apply (const FiniteElement & inner_fel,
646 const BaseMappedIntegrationRule & mir,
647 BareSliceVector<double> x,
648 BareSliceMatrix<double> flux,
649 LocalHeap & lh) const override
650 {
651 HeapReset hr(lh);
652
653 const ElementTransformation & trafo = mir.GetTransformation();
654 ElementId ei = trafo.GetElementId();
655 auto & interpol_fel = fes->GetFE(ei, lh);
656
657 FlatMatrix<double> elmat(interpol_fel.GetNDof(), lh);
658 elmat = 0.0;
659 bool symmetric_so_far = false;
660
661 try
662 {
663 for (auto & sbfi : single_bli)
664 sbfi->CalcElementMatrixAdd (interpol_fel, trafo, elmat, symmetric_so_far, lh);
665 }
666 catch (const ExceptionNOSIMD& e)
667 {
668 cout << IM(6) << e.What() << endl
669 << "switching to scalar evaluation" << endl;
670 for (auto & sbfi : single_bli)
671 sbfi->SetSimdEvaluate(false);
672 for (auto & sbfi : m3_bli)
673 sbfi->SetSimdEvaluate(false);
674 Apply (inner_fel, mir, x, flux, lh);
675 return;
676 }
677
678 CalcInverse(elmat);
679
680 auto save_ud = trafo.PushUserData();
681
682 MixedFiniteElement mfe = (testfunction)
683 ? MixedFiniteElement (interpol_fel, inner_fel)
684 : MixedFiniteElement (inner_fel, interpol_fel);
685
686 if (testfunction)
687 throw Exception("ApplyInterpolation only makes sense for trialfunctions");
688
689 FlatVector<> rhs(interpol_fel.GetNDof(), lh);
690 FlatVector<> rhsi(interpol_fel.GetNDof(), lh);
691 rhs = 0;
692 FlatVector<> fvx(inner_fel.GetNDof(), lh);
693 fvx = x;
694 for (auto & sbfi : m3_bli)
695 {
696 sbfi->ApplyElementMatrix (mfe, trafo, fvx, rhsi, nullptr, lh);
697 rhs += rhsi;
698 }
699
700 rhsi = elmat * rhs;
701 diffop->Apply(interpol_fel, mir, rhsi, flux, lh);
702 }

Callers 2

T_EvaluateMethod · 0.45
T_Evaluate_implMethod · 0.45

Calls 7

IMClass · 0.85
ApplyFunction · 0.85
MixedFiniteElementClass · 0.85
GetTransformationMethod · 0.80
CalcInverseFunction · 0.50
GetNDofMethod · 0.45
ApplyElementMatrixMethod · 0.45

Tested by

no test coverage detected