55 :
public dealii::internal::MatrixFreeFunctions::VectorDataExchange::Base
57 const dealii::types::global_dof_index dofs_per_cell;
58 const dealii::types::global_dof_index dofs_per_face;
59 const std::vector<std::vector<unsigned int>> &face_to_cell_index_nodal;
62 using RankType =
unsigned int;
63 using LocalDoFType =
unsigned int;
64 using CellIdType = dealii::types::global_dof_index;
65 using FaceIdType = std::pair<CellIdType, unsigned int>;
70 template <
typename ShapeInfo>
78 reinit(
const std::vector<dealii::types::global_dof_index> local_cells,
79 const std::vector<std::pair<dealii::types::global_dof_index,
80 std::vector<unsigned int>>>
83 const MPI_Comm comm_sm,
84 const bool do_buffering);
87 locally_owned_size()
const override
89 return n_local_elements;
93 n_ghost_indices()
const override
95 return n_ghost_elements;
99 n_import_indices()
const override
101 return send_ptr.back() * dofs_per_ghost;
106 const dealii::ArrayView<double> &ghost_array)
const override
114 const dealii::ArrayView<float> &ghost_array)
const override
121 n_import_sm_procs()
const override
123 AssertThrow(
false, ExcNotImplemented());
127 types::global_dof_index
128 size()
const override
130 AssertThrow(
false, ExcNotImplemented());
139 const unsigned int communication_channel,
140 const dealii::ArrayView<const double> &locally_owned_array,
141 const std::vector<dealii::ArrayView<const double>> &shared_arrays,
142 const dealii::ArrayView<double> & ghost_array,
143 const dealii::ArrayView<double> & temporary_storage,
144 std::vector<MPI_Request> &requests)
const override;
151 const dealii::ArrayView<const double> &locally_owned_array,
152 const std::vector<dealii::ArrayView<const double>> &shared_arrays,
153 const dealii::ArrayView<double> & ghost_array,
154 std::vector<MPI_Request> &requests)
const override;
161 const dealii::VectorOperation::values vector_operation,
162 const unsigned int communication_channel,
163 const dealii::ArrayView<const double> &locally_owned_array,
164 const std::vector<dealii::ArrayView<const double>> &shared_arrays,
165 const dealii::ArrayView<double> & ghost_array,
166 const dealii::ArrayView<double> & temporary_storage,
167 std::vector<MPI_Request> &requests)
const override;
174 const dealii::VectorOperation::values vector_operation,
175 const dealii::ArrayView<double> & locally_owned_storage,
176 const std::vector<dealii::ArrayView<const double>> &shared_arrays,
177 const dealii::ArrayView<double> & ghost_array,
178 const dealii::ArrayView<const double> & temporary_storage,
179 std::vector<MPI_Request> &requests)
const override;
186 const unsigned int communication_channel,
187 const dealii::ArrayView<const float> &locally_owned_array,
188 const std::vector<dealii::ArrayView<const float>> &shared_arrays,
189 const dealii::ArrayView<float> & ghost_array,
190 const dealii::ArrayView<float> & temporary_storage,
191 std::vector<MPI_Request> &requests)
const override;
198 const dealii::ArrayView<const float> &locally_owned_array,
199 const std::vector<dealii::ArrayView<const float>> &shared_arrays,
200 const dealii::ArrayView<float> & ghost_array,
201 std::vector<MPI_Request> &requests)
const override;
208 const dealii::VectorOperation::values vector_operation,
209 const unsigned int communication_channel,
210 const dealii::ArrayView<const float> &locally_owned_array,
211 const std::vector<dealii::ArrayView<const float>> &shared_arrays,
212 const dealii::ArrayView<float> & ghost_array,
213 const dealii::ArrayView<float> & temporary_storage,
214 std::vector<MPI_Request> &requests)
const override;
221 const dealii::VectorOperation::values vector_operation,
222 const dealii::ArrayView<float> & locally_owned_storage,
223 const std::vector<dealii::ArrayView<const float>> &shared_arrays,
224 const dealii::ArrayView<float> & ghost_array,
225 const dealii::ArrayView<const float> & temporary_storage,
226 std::vector<MPI_Request> &requests)
const override;
231 template <
typename Number>
234 const dealii::ArrayView<const Number> &locally_owned_array,
235 const std::vector<dealii::ArrayView<const Number>> &shared_arrays,
236 const dealii::ArrayView<Number> & ghost_array,
237 std::vector<MPI_Request> & requests)
const;
242 template <
typename Number>
245 const dealii::ArrayView<const Number> &locally_owned_array,
246 const std::vector<dealii::ArrayView<const Number>> &shared_arrays,
247 const dealii::ArrayView<Number> & ghost_array,
248 std::vector<MPI_Request> & requests)
const;
255 template <
typename Number>
257 export_to_ghosted_array_start_impl(
258 const unsigned int communication_channel,
259 const dealii::ArrayView<const Number> &locally_owned_array,
260 const std::vector<dealii::ArrayView<const Number>> &shared_arrays,
261 const dealii::ArrayView<Number> & ghost_array,
262 const dealii::ArrayView<Number> & temporary_storage,
263 std::vector<MPI_Request> & requests)
const;
269 template <
typename Number>
271 export_to_ghosted_array_finish_impl(
272 const dealii::ArrayView<const Number> &locally_owned_array,
273 const std::vector<dealii::ArrayView<const Number>> &shared_arrays,
274 const dealii::ArrayView<Number> & ghost_array,
275 std::vector<MPI_Request> & requests)
const;
281 template <
typename Number>
283 import_from_ghosted_array_start_impl(
284 const dealii::VectorOperation::values vector_operation,
285 const unsigned int communication_channel,
286 const dealii::ArrayView<const Number> &locally_owned_array,
287 const std::vector<dealii::ArrayView<const Number>> &shared_arrays,
288 const dealii::ArrayView<Number> & ghost_array,
289 const dealii::ArrayView<Number> & temporary_storage,
290 std::vector<MPI_Request> & requests)
const;
296 template <
typename Number>
298 import_from_ghosted_array_finish_impl(
299 const dealii::VectorOperation::values vector_operation,
300 const dealii::ArrayView<Number> & locally_owned_storage,
301 const std::vector<dealii::ArrayView<const Number>> &shared_arrays,
302 const dealii::ArrayView<Number> & ghost_array,
303 const dealii::ArrayView<const Number> & temporary_storage,
304 std::vector<MPI_Request> & requests)
const;
310 inline const std::map<dealii::types::global_dof_index,
311 std::pair<unsigned int, unsigned int>> &
318 inline const std::map<
319 std::pair<dealii::types::global_dof_index, unsigned int>,
320 std::pair<unsigned int, unsigned int>> &
335 sync(
const unsigned int tag = 0)
const;
351 unsigned int n_mpi_processes_;
356 unsigned int n_local_elements;
361 unsigned int n_ghost_elements;
365 unsigned int dofs_per_ghost;
368 unsigned int sm_size;
369 unsigned int sm_rank;
372 std::map<CellIdType, std::pair<RankType, LocalDoFType>> maps;
373 std::map<FaceIdType, std::pair<RankType, LocalDoFType>> maps_ghost;
376 std::vector<unsigned int> send_ranks;
377 std::vector<dealii::types::global_dof_index> send_ptr;
378 std::vector<dealii::types::global_dof_index> send_data_id;
379 std::vector<unsigned int> send_data_face_no;
381 std::vector<unsigned int> recv_ranks;
382 std::vector<dealii::types::global_dof_index> recv_ptr;
383 std::vector<dealii::types::global_dof_index> recv_size;
385 std::vector<unsigned int> sm_targets;
386 std::vector<unsigned int> sm_sources;
389 std::vector<dealii::types::global_dof_index> sm_send_ptr;
390 std::vector<unsigned int> sm_send_rank;
391 std::vector<unsigned int> sm_send_offset_1;
392 std::vector<unsigned int> sm_send_offset_2;
393 std::vector<unsigned int> sm_send_no;
395 std::vector<dealii::types::global_dof_index> sm_recv_ptr;
396 std::vector<unsigned int> sm_recv_rank;
397 std::vector<unsigned int> sm_recv_offset_1;
398 std::vector<unsigned int> sm_recv_offset_2;
399 std::vector<unsigned int> sm_recv_no;
672 const std::vector<dealii::types::global_dof_index> local_cells,
674 std::pair<dealii::types::global_dof_index, std::vector<unsigned int>>>
677 const MPI_Comm comm_sm,
678 const bool do_buffering)
682 this->comm_sm = comm_sm;
683 this->n_mpi_processes_ = dealii::Utilities::MPI::n_mpi_processes(comm);
685 this->do_buffering = do_buffering;
687 AssertThrow(local_cells.size() > 0,
688 dealii::ExcMessage(
"No local cells!"));
690 this->n_local_elements = local_cells.size() * dofs_per_cell;
693 const dealii::types::global_dof_index dofs_per_ghost = [&]() {
694 unsigned int result = dofs_per_face;
696 for (
const auto &ghost_faces : local_ghost_faces)
697 for (
const auto ghost_face : ghost_faces.second)
698 if (ghost_face == dealii::numbers::invalid_unsigned_int)
699 result = dofs_per_cell;
700 return dealii::Utilities::MPI::max(result, comm);
703 this->dofs_per_ghost = dofs_per_ghost;
706 const auto sm_procs = hyperdeal::mpi::procs_of_sm(comm, this->comm_sm);
707 const auto sm_rank = [&]() {
709 std::find(sm_procs.begin(),
711 dealii::Utilities::MPI::this_mpi_process(comm));
713 AssertThrow(ptr != sm_procs.end(),
714 dealii::ExcMessage(
"Proc not found!"));
716 return std::distance(sm_procs.begin(), ptr);
719 this->sm_rank = sm_rank;
720 this->sm_size = sm_procs.size();
723 for (
unsigned int i = 0; i < local_cells.size(); i++)
724 this->maps[local_cells[i]] = {sm_rank, i * dofs_per_cell};
729 std::pair<dealii::types::global_dof_index, std::vector<unsigned int>>>
730 local_ghost_faces_remote, local_ghost_faces_shared;
732 const auto n_total_cells = dealii::Utilities::MPI::sum(
733 static_cast<dealii::types::global_dof_index
>(local_cells.size()),
736 dealii::IndexSet is_local_cells(n_total_cells);
737 is_local_cells.add_indices(local_cells.begin(), local_cells.end());
739 dealii::IndexSet is_ghost_cells(n_total_cells);
740 for (
const auto &ghost_faces : local_ghost_faces)
741 is_ghost_cells.add_index(ghost_faces.first);
743 for (
unsigned int i = 0; i < local_ghost_faces.size(); i++)
744 AssertThrow(local_ghost_faces[i].first ==
745 is_ghost_cells.nth_index_in_set(i),
746 dealii::ExcMessage(
"PROBLEM!"));
749 local_ghost_faces.size() == is_ghost_cells.n_elements(),
751 "Dimensions " + std::to_string(local_ghost_faces.size()) +
" " +
752 std::to_string(is_ghost_cells.n_elements()) +
" do not match!"));
754 std::vector<unsigned int> owning_ranks_of_ghosts(
755 is_ghost_cells.n_elements());
758 dealii::Utilities::MPI::internal::ComputeIndexOwner::
759 ConsensusAlgorithmsPayload process(is_local_cells,
762 owning_ranks_of_ghosts,
765 dealii::Utilities::MPI::ConsensusAlgorithms::Selector<
766 std::vector<std::pair<dealii::types::global_dof_index,
767 dealii::types::global_dof_index>>,
768 std::vector<unsigned int>>
770 consensus_algorithm.run(process, comm);
772 std::map<unsigned int, std::vector<dealii::types::global_dof_index>>
773 shared_procs_to_cells;
775 for (
unsigned int i = 0; i < owning_ranks_of_ghosts.size(); i++)
777 AssertThrow(dealii::Utilities::MPI::this_mpi_process(comm) !=
778 owning_ranks_of_ghosts[i],
780 "Locally owned cells should be not ghosted!"));
782 const auto ptr = std::find(sm_procs.begin(),
784 owning_ranks_of_ghosts[i]);
786 if (ptr == sm_procs.end())
787 local_ghost_faces_remote.push_back(local_ghost_faces[i]);
790 local_ghost_faces_shared.push_back(local_ghost_faces[i]);
791 shared_procs_to_cells[std::distance(sm_procs.begin(), ptr)]
792 .emplace_back(local_ghost_faces[i].first);
797 dealii::Utilities::MPI::ConsensusAlgorithms::selector<
798 std::vector<dealii::types::global_dof_index>,
799 std::vector<unsigned int>>(
801 std::vector<unsigned int> result;
802 for (
auto &i : shared_procs_to_cells)
803 result.push_back(i.first);
806 [&](
const auto other_rank) {
807 return shared_procs_to_cells[other_rank];
809 [&](
const auto &other_rank,
const auto &buffer_recv) {
810 std::vector<unsigned int> request_buffer(buffer_recv.size());
812 for (
unsigned int i = 0; i < buffer_recv.size(); i++)
814 const auto value = buffer_recv[i];
816 std::find(local_cells.begin(), local_cells.end(), value);
818 AssertThrow(ptr != local_cells.end(),
820 "Cell " + std::to_string(value) +
" at index " +
821 std::to_string(i) +
" on rank " +
823 dealii::Utilities::MPI::this_mpi_process(
825 " requested by rank " +
826 std::to_string(other_rank) +
" not found!"));
828 request_buffer[i] = std::distance(local_cells.begin(), ptr);
830 return request_buffer;
832 [&](
const auto other_rank,
const auto &recv_buffer) {
833 for (
unsigned int i = 0; i < recv_buffer.size(); i++)
835 const dealii::types::global_dof_index cell =
836 shared_procs_to_cells[other_rank][i];
837 const unsigned int offset = recv_buffer[i];
839 Assert(maps.find(cell) == maps.end(),
840 dealii::ExcMessage(
"Cell " + std::to_string(cell) +
841 " is already in maps!"));
843 this->maps[cell] = {other_rank, offset * dofs_per_cell};
851 const auto local_ghost_faces_remote_pairs_global =
852 [&local_ghost_faces_remote,
this]() {
854 std::pair<dealii::types::global_dof_index, unsigned int>>
855 local_ghost_faces_remote_pairs_local;
859 for (
const auto &ghost_faces : local_ghost_faces_remote)
860 for (
const auto ghost_face : ghost_faces.second)
861 local_ghost_faces_remote_pairs_local.emplace_back(
862 ghost_faces.first, ghost_face);
866 std::pair<dealii::types::global_dof_index, unsigned int>>
867 local_ghost_faces_remote_pairs_global =
868 internal::MPI_Allgather_Pairs(
869 local_ghost_faces_remote_pairs_local, this->comm_sm);
872 std::sort(local_ghost_faces_remote_pairs_global.begin(),
873 local_ghost_faces_remote_pairs_global.end());
875 return local_ghost_faces_remote_pairs_global;
880 auto distributed_local_ghost_faces_remote_pairs_global =
881 [&local_ghost_faces_remote_pairs_global, &sm_procs]() {
882 std::vector<std::vector<
883 std::pair<dealii::types::global_dof_index, unsigned int>>>
884 result(sm_procs.size());
886 unsigned int counter = 0;
887 const unsigned int faces_per_process =
888 (local_ghost_faces_remote_pairs_global.size() + sm_procs.size() -
891 for (
auto p : local_ghost_faces_remote_pairs_global)
892 result[(counter++) / faces_per_process].push_back(p);
899 std::vector<std::pair<dealii::types::global_dof_index, unsigned int>>
900 local_ghost_faces_remote_pairs_local;
902 for (
const auto &ghost_faces : local_ghost_faces_remote)
903 for (
const auto ghost_face : ghost_faces.second)
904 local_ghost_faces_remote_pairs_local.emplace_back(
905 ghost_faces.first, ghost_face);
907 distributed_local_ghost_faces_remote_pairs_global.clear();
908 distributed_local_ghost_faces_remote_pairs_global.resize(
910 distributed_local_ghost_faces_remote_pairs_global[sm_rank] =
911 local_ghost_faces_remote_pairs_local;
916 this->n_ghost_elements =
917 (distributed_local_ghost_faces_remote_pairs_global[sm_rank].size() +
919 std::accumulate(local_ghost_faces_shared.begin(),
920 local_ghost_faces_shared.end(),
922 [](
const std::size_t &a,
const auto &b) {
923 return a + b.second.size();
930 this->maps_ghost = [&]() {
931 std::map<std::pair<dealii::types::global_dof_index, unsigned int>,
932 std::pair<unsigned int, unsigned int>>
936 unsigned int my_offset = local_cells.size() * dofs_per_cell;
940 for (
const auto &pair : local_ghost_faces_shared)
941 for (
const auto &face : pair.second)
943 maps_ghost[{pair.first, face}] = {sm_rank, my_offset};
944 my_offset += dofs_per_ghost;
948 const auto maps_ghost_inverse =
949 [&distributed_local_ghost_faces_remote_pairs_global,
954 std::vector<unsigned int> offsets(sm_procs.size());
956 MPI_Allgather(&my_offset,
958 dealii::Utilities::MPI::mpi_type_id_for_type<
959 decltype(my_offset)>,
962 dealii::Utilities::MPI::mpi_type_id_for_type<
963 decltype(my_offset)>,
966 std::map<std::pair<unsigned int, unsigned int>,
967 std::pair<dealii::types::global_dof_index, unsigned int>>
970 for (
unsigned int i = 0; i < sm_procs.size(); i++)
971 for (
unsigned int j = 0;
972 j < distributed_local_ghost_faces_remote_pairs_global[i]
976 [distributed_local_ghost_faces_remote_pairs_global[i][j]] =
977 {i, offsets[i] + j * dofs_per_ghost};
979 return maps_ghost_inverse;
984 for (
const auto &i : local_ghost_faces_remote)
985 for (
const auto &j : i.second)
986 maps_ghost[{i.first, j}] = maps_ghost_inverse.at({i.first, j});
989 distributed_local_ghost_faces_remote_pairs_global[sm_rank])
990 maps_ghost[i] = maps_ghost_inverse.at(i);
996 std::vector<std::array<LocalDoFType, 5>> ghost_list_shared_precomp;
997 std::vector<std::array<LocalDoFType, 5>> maps_ghost_inverse_precomp;
1001 std::map<unsigned int, std::vector<std::array<LocalDoFType, 5>>>
1004 for (
const auto &pair : local_ghost_faces_shared)
1005 for (
const auto &face : pair.second)
1007 const auto ptr1 = maps.find(pair.first);
1008 AssertThrow(ptr1 != maps.end(),
1009 dealii::ExcMessage(
"Entry not found!"));
1011 const auto ptr2 = maps_ghost.find({pair.first, face});
1012 AssertThrow(ptr2 != maps_ghost.end(),
1013 dealii::ExcMessage(
"Entry not found!"));
1015 std::array<LocalDoFType, 5> v{{ptr1->second.first,
1016 ptr1->second.second,
1019 ptr2->second.second}};
1021 ghost_list_shared_precomp.push_back(v);
1023 send_data[ptr1->second.first].push_back(v);
1026 dealii::Utilities::MPI::ConsensusAlgorithms::selector<
1027 std::vector<LocalDoFType>>(
1029 std::vector<unsigned int> result;
1030 for (
auto &i : send_data)
1031 result.push_back(i.first);
1034 [&](
const auto other_rank) {
1035 std::vector<LocalDoFType> send_buffer;
1037 for (
const auto &i : send_data[other_rank])
1038 for (
const auto &j : i)
1039 send_buffer.push_back(j);
1043 [&](
const auto & ,
const auto &buffer_recv) {
1044 for (
unsigned int i = 0; i < buffer_recv.size(); i += 5)
1045 maps_ghost_inverse_precomp.push_back({{buffer_recv[i],
1049 buffer_recv[i + 4]}});
1053 std::sort(maps_ghost_inverse_precomp.begin(),
1054 maps_ghost_inverse_precomp.end());
1058 std::map<unsigned int, std::pair<unsigned int, unsigned int>>
1060 std::map<unsigned int, std::vector<std::array<unsigned int, 3>>>
1061 requests_from_relevant_precomp;
1066 &distributed_local_ghost_faces_remote_pairs_global,
1069 &dofs_per_ghost](
auto & requests_from_relevant_precomp,
1070 auto & receive_info,
1072 const auto &maps_ghost) {
1074 const auto n_total_cells = dealii::Utilities::MPI::sum(
1075 static_cast<dealii::types::global_dof_index
>(local_cells.size()),
1080 dealii::IndexSet is_local_cells(n_total_cells);
1081 is_local_cells.add_indices(local_cells.begin(), local_cells.end());
1084 dealii::IndexSet is_ghost_cells(n_total_cells);
1085 for (
const auto &ghost_faces :
1086 distributed_local_ghost_faces_remote_pairs_global[sm_rank])
1087 is_ghost_cells.add_index(ghost_faces.first);
1090 const auto owning_ranks_of_ghosts = [&]() {
1091 std::vector<unsigned int> owning_ranks_of_ghosts(
1092 is_ghost_cells.n_elements());
1094 dealii::Utilities::MPI::internal::ComputeIndexOwner::
1095 ConsensusAlgorithmsPayload process(is_local_cells,
1098 owning_ranks_of_ghosts,
1101 dealii::Utilities::MPI::ConsensusAlgorithms::Selector<
1102 std::vector<std::pair<dealii::types::global_dof_index,
1103 dealii::types::global_dof_index>>,
1104 std::vector<unsigned int>>
1105 consensus_algorithm;
1106 consensus_algorithm.run(process, comm);
1108 return owning_ranks_of_ghosts;
1112 const auto send_ranks = [&]() {
1113 std::set<unsigned int> send_ranks_set;
1115 for (
const auto &i : owning_ranks_of_ghosts)
1116 send_ranks_set.insert(i);
1118 const std::vector<unsigned int> send_ranks(send_ranks_set.begin(),
1119 send_ranks_set.end());
1125 const auto send_data = [&]() {
1126 std::vector<std::vector<std::pair<dealii::types::global_dof_index,
1127 dealii::types::global_dof_index>>>
1128 send_data(send_ranks.size());
1130 unsigned int index = 0;
1131 unsigned int index_cell = dealii::numbers::invalid_unsigned_int;
1133 for (
const auto &ghost_faces :
1134 distributed_local_ghost_faces_remote_pairs_global[sm_rank])
1136 if (index_cell != ghost_faces.first)
1138 index_cell = ghost_faces.first;
1139 const unsigned int index_rank =
1140 owning_ranks_of_ghosts[is_ghost_cells.index_within_set(
1141 ghost_faces.first)];
1142 index = std::distance(send_ranks.begin(),
1143 std::find(send_ranks.begin(),
1147 send_data[index].emplace_back(ghost_faces.first,
1148 ghost_faces.second);
1155 std::vector<MPI_Request> send_requests(send_ranks.size());
1157 for (
unsigned int i = 0; i < send_ranks.size(); i++)
1159 MPI_Isend(send_data[i].data(),
1160 2 * send_data[i].size(),
1161 dealii::Utilities::MPI::mpi_type_id_for_type<
1162 dealii::types::global_dof_index>,
1166 send_requests.data() + i);
1168 receive_info[send_ranks[i]] = {
1169 send_data[i].size() * dofs_per_ghost,
1170 maps_ghost.at(send_data[i][0]).second};
1175 const auto targets = dealii::Utilities::MPI::
1176 compute_point_to_point_communication_pattern(comm, send_ranks);
1179 for (
unsigned int i = 0; i < targets.size(); i++)
1183 auto ierr = MPI_Probe(MPI_ANY_SOURCE, 105, comm, &status);
1184 AssertThrowMPI(ierr);
1189 MPI_Get_count(&status,
1190 dealii::Utilities::MPI::mpi_type_id_for_type<
1191 dealii::types::global_dof_index>,
1194 AssertThrow(len % 2 == 0,
1195 dealii::ExcMessage(
"Length " + std::to_string(len) +
1196 " is not a multiple of two!"));
1199 std::vector<std::pair<dealii::types::global_dof_index,
1200 dealii::types::global_dof_index>>
1204 ierr = MPI_Recv(recv_data.data(),
1206 dealii::Utilities::MPI::mpi_type_id_for_type<
1207 dealii::types::global_dof_index>,
1212 AssertThrowMPI(ierr);
1215 requests_from_relevant_precomp[status.MPI_SOURCE] = [&]() {
1216 std::vector<std::array<unsigned int, 3>> temp(len / 2);
1217 for (
unsigned int i = 0; i < static_cast<unsigned int>(len) / 2;
1220 const CellIdType cell = recv_data[i].first;
1221 const unsigned int face_no = recv_data[i].second;
1223 const auto ptr = maps.find(cell);
1224 AssertThrow(ptr != maps.end(),
1225 dealii::ExcMessage(
"Entry " +
1226 std::to_string(cell) +
1229 temp[i] = std::array<unsigned int, 3>{
1231 (
unsigned int)ptr->second.second,
1239 MPI_Waitall(send_requests.size(),
1240 send_requests.data(),
1241 MPI_STATUSES_IGNORE);
1242 }(requests_from_relevant_precomp,
1253 for (
const auto &i : receive_info)
1255 recv_ranks.push_back(i.first);
1256 recv_size.push_back(i.second.first);
1257 recv_ptr.push_back(i.second.second -
1258 local_cells.size() * dofs_per_cell);
1264 send_ptr.push_back(0);
1266 for (
const auto &i : requests_from_relevant_precomp)
1268 send_ranks.push_back(i.first);
1270 for (
const auto &j : i.second)
1272 AssertThrow(j[0] == sm_rank,
1273 dealii::StandardExceptions::ExcNotImplemented());
1274 send_data_id.push_back(j[1]);
1275 send_data_face_no.push_back(j[2]);
1278 send_ptr.push_back(send_data_id.size());
1283 std::set<unsigned int> temp;
1285 for (
const auto &i : maps)
1286 if (i.second.first != sm_rank)
1287 temp.insert(i.second.first);
1289 for (
const auto &i : temp)
1290 this->sm_sources.push_back(i);
1292 this->sm_targets = dealii::Utilities::MPI::
1293 compute_point_to_point_communication_pattern(this->comm_sm,
1299 auto temp = ghost_list_shared_precomp;
1300 std::sort(temp.begin(), temp.end());
1303 std::vector<std::array<dealii::types::global_dof_index, 3>>>
1308 AssertThrow(sm_rank == t[3],
1309 dealii::StandardExceptions::ExcNotImplemented());
1310 temp_[t[0]].emplace_back(
1311 std::array<dealii::types::global_dof_index, 3>{
1312 {t[1], t[2], t[4]}});
1316 sm_send_ptr.push_back(0);
1318 for (
unsigned int i = 0; i < temp_.size(); i++)
1320 if (temp_[i].size() == 0)
1323 sm_send_rank.push_back(i);
1325 for (
const auto &v : temp_[i])
1327 sm_send_offset_1.push_back(v[2] - local_cells.size() *
1329 sm_send_offset_2.push_back(v[0]);
1330 sm_send_no.push_back(v[1]);
1333 sm_send_ptr.push_back(sm_send_no.size());
1336 AssertThrow(sm_send_rank.size() == sm_sources.size(),
1337 dealii::StandardExceptions::ExcNotImplemented());
1342 auto temp = maps_ghost_inverse_precomp;
1343 std::sort(temp.begin(), temp.end());
1346 std::vector<std::array<dealii::types::global_dof_index, 3>>>
1351 AssertThrow(sm_rank == t[0],
1352 dealii::StandardExceptions::ExcNotImplemented());
1353 temp_[t[3]].emplace_back(
1354 std::array<dealii::types::global_dof_index, 3>{
1355 {t[4], t[2], t[1]}});
1359 sm_recv_ptr.push_back(0);
1361 for (
unsigned int i = 0; i < temp_.size(); i++)
1363 if (temp_[i].size() == 0)
1366 sm_recv_rank.push_back(i);
1368 for (
const auto &v : temp_[i])
1370 sm_recv_offset_1.push_back(v[2]);
1371 sm_recv_offset_2.push_back(v[0]);
1372 sm_recv_no.push_back(v[1]);
1375 sm_recv_ptr.push_back(sm_recv_no.size());
1378 AssertThrow(sm_recv_rank.size() == sm_targets.size(),
1379 dealii::StandardExceptions::ExcNotImplemented());