From 67c4daac90be22c6d0e2bac2bb28c0add60e71b6 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 8 Jul 2022 17:38:08 -0600 Subject: [PATCH] Simplify some MPI code. --- source/multigrid/mg_transfer_internal.cc | 35 +++++++----------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/source/multigrid/mg_transfer_internal.cc b/source/multigrid/mg_transfer_internal.cc index e5357ac76c..f442e6b9e6 100644 --- a/source/multigrid/mg_transfer_internal.cc +++ b/source/multigrid/mg_transfer_internal.cc @@ -291,31 +291,16 @@ namespace internal { requests.push_back(MPI_Request()); std::vector &data = send_data[dest]; - // If there is nothing to send, we still need to send a message, - // because the receiving end will be waitng. In that case we - // just send an empty message. - if (data.size()) - { - const int ierr = MPI_Isend(data.data(), - data.size() * sizeof(data[0]), - MPI_BYTE, - dest, - mpi_tag, - tria->get_communicator(), - &*requests.rbegin()); - AssertThrowMPI(ierr); - } - else - { - const int ierr = MPI_Isend(nullptr, - 0, - MPI_BYTE, - dest, - mpi_tag, - tria->get_communicator(), - &*requests.rbegin()); - AssertThrowMPI(ierr); - } + + const int ierr = + MPI_Isend(data.data(), + data.size() * sizeof(decltype(*data.data())), + MPI_BYTE, + dest, + mpi_tag, + tria->get_communicator(), + &*requests.rbegin()); + AssertThrowMPI(ierr); } } -- 2.39.5