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

Method CalcLinearizedMatrix

comp/interpolate.cpp:560–642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558
559
560 void CalcLinearizedMatrix (const FiniteElement & inner_fel,
561 const BaseMappedIntegrationRule & mir,
562 BareSliceVector<double> x,
563 SliceMatrix<double,ColMajor> mat,
564 LocalHeap & lh) const override
565 {
566 static Timer t("CAlcLinearizedBMatrix");
567 RegionTracer reg(TaskManager::GetThreadId(), t);
568
569
570 HeapReset hr(lh);
571
572 const ElementTransformation & trafo = mir.GetTransformation();
573 ElementId ei = trafo.GetElementId();
574 auto & interpol_fel = fes->GetFE(ei, lh);
575
576 FlatMatrix<double> elmat(interpol_fel.GetNDof(), lh);
577 elmat = 0.0;
578 bool symmetric_so_far = false;
579
580 try
581 {
582 for (auto & sbfi : single_bli)
583 sbfi->CalcElementMatrixAdd (interpol_fel, trafo, elmat, symmetric_so_far, lh);
584 }
585 catch (const ExceptionNOSIMD& e)
586 {
587 cout << IM(6) << e.What() << endl
588 << "switching to scalar evaluation" << endl;
589 for (auto & sbfi : single_bli)
590 sbfi->SetSimdEvaluate(false);
591 for (auto & sbfi : m3_bli)
592 sbfi->SetSimdEvaluate(false);
593 CalcLinearizedMatrix (inner_fel, mir, x, mat, lh);
594 return;
595 }
596
597 CalcInverse(elmat);
598 size_t nshape = inner_fel.GetNDof();
599
600 auto save_ud = trafo.PushUserData();
601
602 auto & func_fel = inner_fel;
603
604 MixedFiniteElement mfe = (testfunction)
605 ? MixedFiniteElement (interpol_fel, func_fel)
606 : MixedFiniteElement (func_fel, interpol_fel);
607
608 FlatMatrix<> m2m3 (elmat.Height(), nshape, lh);
609
610 if (testfunction)
611 {
612 FlatMatrix<> m3T(nshape, interpol_fel.GetNDof(), lh);
613 FlatMatrix<> m3Ti(nshape, interpol_fel.GetNDof(), lh);
614 FlatVector<> elvec(nshape, lh);
615 elvec = x;
616 m3T = 0.0;
617 for (auto & sbfi : m3_bli)

Callers 2

Calls 11

IMClass · 0.85
MixedFiniteElementClass · 0.85
GetTransformationMethod · 0.80
CalcInverseFunction · 0.50
TransFunction · 0.50
DimFunction · 0.50
GetNDofMethod · 0.45
HeightMethod · 0.45
SizeMethod · 0.45
CalcMatrixMethod · 0.45

Tested by

no test coverage detected