| 1394 | |
| 1395 | template<typename SCAL> |
| 1396 | void APhiHCurlAMG::AddElementMatrixCommon(FlatArray<int> dnums, |
| 1397 | FlatMatrix<SCAL> belmat, |
| 1398 | ElementId id, LocalHeap & lh) |
| 1399 | { |
| 1400 | if(dnums.Size() != 10) |
| 1401 | throw Exception("Only tets implemented yet!"); |
| 1402 | if(L2Norm(belmat) == 0) |
| 1403 | return; |
| 1404 | auto ndofhc = 6; |
| 1405 | auto ndofh1 = 4; |
| 1406 | auto dnumshc = dnums.Range(0,ndofhc); |
| 1407 | // auto dnumsh1 = dnums.Range(ndofhc, END); |
| 1408 | FlatMatrix<SCAL> elmathc = belmat.Rows(ndofhc).Cols(ndofhc) | lh; |
| 1409 | double reg = 1e-10 * L2Norm(elmathc); |
| 1410 | for(auto i : Range(ndofhc)) |
| 1411 | elmathc(i,i) += reg; |
| 1412 | auto elmath1 = belmat.Rows(ndofhc, ndofhc+ndofh1).Cols(ndofhc, ndofhc+ndofh1); |
| 1413 | auto ma = fes->GetMeshAccess(); |
| 1414 | HeapReset hr(lh); |
| 1415 | BitArray usedh1(ndofh1, lh); |
| 1416 | |
| 1417 | FlatMatrix<SCAL> schur_edge(2, lh); |
| 1418 | auto e2v = ElementTopology::GetEdges(ET_TET); |
| 1419 | for(auto edge : Range(ndofhc)) |
| 1420 | { |
| 1421 | auto v1v2 = e2v[edge]; |
| 1422 | schur_edge = 0; |
| 1423 | usedh1.Clear(); |
| 1424 | usedh1.SetBit(v1v2[0]); |
| 1425 | usedh1.SetBit(v1v2[1]); |
| 1426 | CalcSchurComplement(elmath1, schur_edge, usedh1, lh); |
| 1427 | double weight = fabs(schur_edge(0,0)) + fabs(schur_edge(1,1)); |
| 1428 | weight /= 2.; |
| 1429 | edge_weights_ht.Do(IVec<1>(dnumshc[edge]), [weight] (auto &v) { v+= weight; }); |
| 1430 | } |
| 1431 | FlatMatrix<SCAL> schur_face(3, lh); |
| 1432 | BitArray usedhc(ndofhc, lh); |
| 1433 | static int f2e[4][3] = |
| 1434 | { { 1, 2, 5}, |
| 1435 | { 0, 2, 4}, |
| 1436 | { 0, 1, 3}, |
| 1437 | { 3, 4, 5} |
| 1438 | }; |
| 1439 | for(auto face : Range(4)) |
| 1440 | { |
| 1441 | schur_face = 0.; |
| 1442 | usedhc.Clear(); |
| 1443 | for(auto e : f2e[face]) |
| 1444 | usedhc.SetBit(e); |
| 1445 | CalcSchurComplement(elmathc, schur_face, usedhc, lh); |
| 1446 | double face_weight = 0.; |
| 1447 | for(auto i : Range(3)) |
| 1448 | face_weight += fabs(schur_face(i,i)); |
| 1449 | face_weight /= 3; |
| 1450 | if(!isnan(face_weight)) |
| 1451 | face_weights_ht.Do(IVec<3>(dnumshc[f2e[face][0]], |
| 1452 | dnumshc[f2e[face][1]], |
| 1453 | dnumshc[f2e[face][2]]).Sort(), |
nothing calls this directly
no test coverage detected