136 const std::vector<std::vector<types::global_dof_index>> &indices,
145 template <
typename T>
146 using get_mpi_communicator_t =
147 decltype(std::declval<const T>().get_mpi_communicator());
149 template <
typename T>
150 constexpr bool has_get_mpi_communicator =
151 ::internal::is_supported_operation<get_mpi_communicator_t, T>;
153 template <
typename T>
154 using local_size_t =
decltype(std::declval<const T>().local_size());
156 template <
typename T>
158 ::internal::is_supported_operation<local_size_t, T>;
161 std::enable_if_t<has_get_mpi_communicator<SparseMatrixType>,
170 std::enable_if_t<!has_get_mpi_communicator<SparseMatrixType>,
180 std::enable_if_t<has_local_size<SparseMatrixType>,
189 std::enable_if_t<!has_local_size<SparseMatrixType>,
201 template <
typename Number,
204 std::vector<std::vector<std::pair<types::global_dof_index, Number>>>
223 std::pair<types::global_dof_index, types::global_dof_index>>,
224 std::vector<unsigned int>>
228 using T1 = std::vector<
230 std::vector<std::pair<types::global_dof_index, Number>>>>;
232 auto requesters = process.get_requesters();
234 std::vector<std::vector<std::pair<types::global_dof_index, Number>>>
238 std::vector<unsigned int>
ranks;
239 ranks.reserve(requesters.size());
241 for (
const auto &i : requesters)
245 locally_owned_dofs.n_elements());
252 std::map<unsigned int, T1> data;
255 std::vector<std::pair<types::global_dof_index, Number>>>
263 const auto row = locally_owned_dofs.nth_index_in_set(i);
264 auto entry = system_matrix.begin(row);
266 const unsigned int row_length = sparsity_pattern.row_length(row);
269 buffer.second.resize(row_length);
271 for (
unsigned int j = 0;
j < row_length; ++
j, ++entry)
272 buffer.second[
j] = {entry->column(), entry->value()};
278 ::Utilities::MPI::ConsensusAlgorithms::selector<T1>(
286 .index_within_set(i.first)];
288 std::sort(dst.begin(),
290 [](
const auto &a,
const auto &b) {
291 return a.first < b.first;
340 internal::extract_remote_rows<typename SparseMatrixType2::value_type>(
344 internal::get_mpi_communicator(system_matrix));
355 [](
const auto &a,
const auto &b) {
356 return a.size() < b.size();
363 std::vector<typename SparseMatrixType2::value_type>
temp_values;
452 const std::vector<std::vector<types::global_dof_index>> &indices,
456 const auto local_size = internal::get_local_size(system_matrix);
458 local_size, internal::get_mpi_communicator(system_matrix));
460 locally_owned_dofs.add_range(std::get<0>(
prefix_sum),
465 for (
const auto &i : indices)
480 internal::extract_remote_rows<Number>(system_matrix,
483 internal::get_mpi_communicator(
489 blocks.resize(indices.size());
491 for (
unsigned int c = 0; c < indices.size(); ++c)
493 if (indices[c].empty())
496 const auto &local_dof_indices = indices[c];
500 const unsigned int dofs_per_cell = indices[c].size();
507 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
508 for (
unsigned int j = 0;
j < dofs_per_cell; ++
j)
510 if (locally_owned_dofs.is_element(
511 local_dof_indices[i]))
514 sparsity_pattern.exists(local_dof_indices[i],
515 local_dof_indices[
j]) ?
516 system_matrix(local_dof_indices[i],
517 local_dof_indices[
j]) :
528 local_dof_indices[i])];
533 std::pair<types::global_dof_index, Number>{
534 local_dof_indices[j], 0.0},
535 [](
const auto a,
const auto b) {
536 return a.first < b.first;
540 local_dof_indices[
j] == ptr->first)
563 all_dof_indices.resize(dof_handler.get_triangulation().n_active_cells());
565 for (
const auto &cell : dof_handler.active_cell_iterators())
567 if (cell->is_locally_owned() ==
false)
571 local_dof_indices.resize(cell->get_fe().n_dofs_per_cell());
572 cell->get_dof_indices(local_dof_indices);