819 const unsigned int face_index,
825 ExcMessage(
"This cell must be a master one."));
828 const auto &neigh_polytope = it->neighbor(face_index);
830 const CellId polytope_in_id = cell->id();
838 polytope_out_id = neigh_polytope->id();
840 polytope_out_id = polytope_in_id;
843 {polytope_in_id, polytope_out_id});
845 std::vector<Point<spacedim>> final_unit_q_points;
846 std::vector<double> final_weights;
847 std::vector<Tensor<1, dim>> final_normals;
849 const unsigned int expected_qpoints =
851 final_unit_q_points.reserve(expected_qpoints);
852 final_weights.reserve(expected_qpoints);
853 final_normals.reserve(expected_qpoints);
856 for (
const auto &[deal_cell, local_face_idx] : common_face)
860 const auto &q_points =
863 const auto &normals = handler.
no_face_values->get_normal_vectors();
865 const unsigned int n_qpoints_agglo = q_points.size();
867 for (
unsigned int q = 0; q < n_qpoints_agglo; ++q)
869 final_unit_q_points.push_back(bbox.real_to_unit(q_points[q]));
870 final_weights.push_back(JxWs[q]);
871 final_normals.push_back(normals[q]);
876 final_unit_q_points, final_weights, final_normals);
879 std::make_unique<NonMatching::FEImmersedSurfaceValues<spacedim>>(
885 agglo_isv_ptr->reinit(cell);
887 return *agglo_isv_ptr;
906 ->global_active_cell_index()] ==
908 ExcMessage(
"The present cell with index " +
909 std::to_string(master_cell->global_active_cell_index()) +
910 "is not a master one."));
916 CellId current_polytope_id = master_cell->id();
919 std::set<types::global_cell_index> visited_polygonal_neighbors;
921 std::map<unsigned int, CellId> face_to_neigh_id;
923 std::map<unsigned int, bool> is_face_at_boundary;
926 std::set<CellId> visited_polygonal_neighbors_id;
927 unsigned int ghost_counter = 0;
929 for (
const auto &cell : agglomeration)
932 cell->active_cell_index();
934 const CellId cell_id = cell->id();
936 for (
const auto f : cell->face_indices())
938 const auto &neighboring_cell = cell->neighbor(f);
940 const bool valid_neighbor =
945 if (neighboring_cell->is_locally_owned() &&
971 neighboring_cell->active_cell_index();
974 const auto &master_of_neighbor =
976 neighboring_cell_index);
978 const auto nof = cell->neighbor_of_neighbor(f);
984 neighbor_polytope_index =
986 master_of_neighbor->active_cell_index());
988 CellId neighbor_polytope_id =
989 master_of_neighbor->id();
991 if (visited_polygonal_neighbors.find(
992 neighbor_polytope_index) ==
993 std::end(visited_polygonal_neighbors))
997 const unsigned int n_face =
999 [current_polytope_index];
1002 current_polytope_index, n_face}] = {
1003 false, master_of_neighbor};
1005 is_face_at_boundary[n_face] =
true;
1008 [current_polytope_index];
1010 visited_polygonal_neighbors.insert(
1011 neighbor_polytope_index);
1016 .find({cell_index, f}) ==
1018 .visited_cell_and_faces))
1022 current_polytope_id, neighbor_polytope_id}]
1023 .emplace_back(cell, f);
1031 .find({neighboring_cell_index, nof}) ==
1033 .visited_cell_and_faces))
1037 neighbor_polytope_id, current_polytope_id}]
1038 .emplace_back(neighboring_cell, nof);
1041 .insert({neighboring_cell_index, nof});
1050 neighbor_polytope_index =
1052 neighboring_cell_index);
1054 CellId neighbor_polytope_id =
1055 neighboring_cell->id();
1057 if (visited_polygonal_neighbors.find(
1058 neighbor_polytope_index) ==
1059 std::end(visited_polygonal_neighbors))
1062 const unsigned int n_face =
1064 [current_polytope_index];
1068 current_polytope_index, n_face}] = {
1069 false, neighboring_cell};
1071 is_face_at_boundary[n_face] =
true;
1074 [current_polytope_index];
1076 visited_polygonal_neighbors.insert(
1077 neighbor_polytope_index);
1083 .find({cell_index, f}) ==
1085 .visited_cell_and_faces))
1089 current_polytope_id, neighbor_polytope_id}]
1090 .emplace_back(cell, f);
1097 .find({neighboring_cell_index, nof}) ==
1099 .visited_cell_and_faces))
1103 neighbor_polytope_id, current_polytope_id}]
1104 .emplace_back(neighboring_cell, nof);
1107 .insert({neighboring_cell_index, nof});
1111 else if (neighboring_cell->is_ghost())
1113 const auto nof = cell->neighbor_of_neighbor(f);
1120 const auto &check_neigh_poly_ids =
1122 neighboring_cell->subdomain_id());
1124 const CellId neighboring_cell_id =
1125 neighboring_cell->id();
1127 const CellId &check_neigh_polytope_id =
1128 check_neigh_poly_ids.at(neighboring_cell_id);
1133 if (visited_polygonal_neighbors_id.find(
1134 check_neigh_polytope_id) ==
1135 std::end(visited_polygonal_neighbors_id))
1138 current_polytope_index,
1140 [current_polytope_index]}] = {
false,
1146 current_polytope_id,
1148 [current_polytope_index]}] =
1149 check_neigh_polytope_id;
1152 const unsigned int n_face =
1154 [current_polytope_index];
1156 face_to_neigh_id[n_face] = check_neigh_polytope_id;
1158 is_face_at_boundary[n_face] =
false;
1163 [current_polytope_index];
1165 visited_polygonal_neighbors_id.insert(
1166 check_neigh_polytope_id);
1176 .find({cell_id, f}) ==
1182 current_polytope_id, check_neigh_polytope_id}]
1183 .emplace_back(cell, f);
1193 .insert({cell_id, f});
1198 .find({neighboring_cell_id, nof}) ==
1204 check_neigh_polytope_id, current_polytope_id}]
1205 .emplace_back(neighboring_cell, nof);
1208 .insert({neighboring_cell_id, nof});
1212 else if (cell->face(f)->at_boundary())
1220 if (visited_polygonal_neighbors.find(
1221 std::numeric_limits<unsigned int>::max()) ==
1222 std::end(visited_polygonal_neighbors))
1227 current_polytope_index,
1229 [current_polytope_index]}] = {
true,
1232 const unsigned int n_face =
1234 [current_polytope_index];
1236 is_face_at_boundary[n_face] =
true;
1239 [current_polytope_index];
1241 visited_polygonal_neighbors.insert(
1242 std::numeric_limits<unsigned int>::max());
1253 current_polytope_id, current_polytope_id}]
1254 .emplace_back(cell, f);
1265 if (ghost_counter > 0)
1267 const auto parallel_triangulation =
dynamic_cast<
1268 const dealii::parallel::TriangulationBase<dim, spacedim> *
>(
1271 const unsigned int n_faces_current_poly =
1277 for (
const unsigned int neigh_rank :
1278 parallel_triangulation->ghost_owners())
1280 handler.
local_n_faces[neigh_rank].emplace(current_polytope_id,
1281 n_faces_current_poly);
1284 current_polytope_id, is_face_at_boundary);
1287 current_polytope_id, face_to_neigh_id);