From c517485f61e10901304462e0cf1a55626357992f Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sat, 6 Jan 2024 13:49:04 +0100 Subject: [PATCH] Simplify code internal::extract_remote_rows() --- include/deal.II/lac/sparse_matrix_tools.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/include/deal.II/lac/sparse_matrix_tools.h b/include/deal.II/lac/sparse_matrix_tools.h index c3e0eae385..fac58460cc 100644 --- a/include/deal.II/lac/sparse_matrix_tools.h +++ b/include/deal.II/lac/sparse_matrix_tools.h @@ -252,6 +252,10 @@ namespace SparseMatrixTools std::map data; + std::pair>> + buffer; + for (unsigned int i = 0; i < row_to_procs.size(); ++i) { if (row_to_procs[i].empty()) @@ -262,22 +266,13 @@ namespace SparseMatrixTools const unsigned int row_length = sparsity_pattern.row_length(row); - - std::pair>> - buffer; buffer.first = row; + buffer.second.resize(row_length); - for (unsigned int i = 0; i < row_length; ++i) - { - buffer.second.emplace_back(entry->column(), entry->value()); - - if (i + 1 != row_length) - ++entry; - } + for (unsigned int j = 0; j < row_length; ++j, ++entry) + buffer.second[j] = {entry->column(), entry->value()}; - for (const auto &proc : - row_to_procs[locally_owned_dofs.index_within_set(buffer.first)]) + for (const auto &proc : row_to_procs[i]) data[proc].emplace_back(buffer); } -- 2.39.5