| 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) |
no test coverage detected