| 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 | { |
nothing calls this directly
no test coverage detected