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

Method AddElementMatrixCommon

comp/hcurlamg.cpp:1050–1097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1048
1049 template<typename SCAL>
1050 void HCurlAMG :: AddElementMatrixCommon(FlatArray<int> dnums,
1051 FlatMatrix<SCAL> elmat,
1052 ElementId id, LocalHeap & lh)
1053 {
1054 // static Timer t("addelmat"); RegionTimer reg(t);
1055 if(L2Norm2(elmat) == 0)
1056 return;
1057
1058 auto ndof = dnums.Size();
1059 auto & ma = fes->GetMeshAccess();
1060 HeapReset hr(lh);
1061 BitArray used(ndof, lh);
1062
1063 FlatMatrix<SCAL> schur_edge(1, lh);
1064 for(auto i : Range(ndof))
1065 {
1066 schur_edge = 0;
1067 used.Clear();
1068 used.SetBit(i);
1069 CalcSchurComplement(elmat, schur_edge, used, lh);
1070 double weight = fabs(schur_edge(0,0));
1071 edge_weights_ht.Do(IVec<1>(dnums[i]), [weight] (auto &v) { v+= weight; });
1072 }
1073
1074 auto el = ma->GetElement(id);
1075 ArrayMem<DofId, 3> fdofs;
1076 ArrayMem<DofId, 3> local_fdofs;
1077 FlatMatrix<SCAL> schur_face(3, lh);
1078 for(const auto& fnr : el.Faces())
1079 {
1080 auto fdofs = ma->GetFaceEdges(fnr);
1081 local_fdofs.SetSize(0);
1082 for(auto d : fdofs)
1083 local_fdofs.Append(dnums.Pos(d));
1084 schur_face = 0.;
1085 used.Clear();
1086 for(auto ld : local_fdofs)
1087 used.SetBit(ld);
1088 CalcSchurComplement(elmat, schur_face, used, lh);
1089 double face_weight = 0.;
1090 for(auto i : Range(3))
1091 face_weight += fabs(schur_face(i,i));
1092 face_weight /= 3;
1093 if(!isnan(face_weight))
1094 face_weights_ht.Do(IVec<3>(fdofs[0], fdofs[1], fdofs[2]).Sort(),
1095 [face_weight] (auto& fw) { fw += face_weight; });
1096 }
1097 }
1098
1099 void HCurlAMG :: FinalizeLevel(const BaseMatrix* matrix)
1100 {

Callers

nothing calls this directly

Calls 11

fabsFunction · 0.85
GetMeshAccessMethod · 0.80
ClearMethod · 0.80
FacesMethod · 0.80
CalcSchurComplementFunction · 0.70
L2Norm2Function · 0.50
RangeFunction · 0.50
SizeMethod · 0.45
DoMethod · 0.45
SetSizeMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected