From: Wolfgang Bangerth Date: Thu, 16 Dec 2021 05:37:51 +0000 (-0700) Subject: Avoid the need for empty lambda functions in ConsensusAlgorithms::AnonymousProcess. X-Git-Tag: v9.4.0-rc1~727^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13088%2Fhead;p=dealii.git Avoid the need for empty lambda functions in ConsensusAlgorithms::AnonymousProcess. --- diff --git a/include/deal.II/base/mpi_consensus_algorithms.h b/include/deal.II/base/mpi_consensus_algorithms.h index 45fb9388a2..919653c44a 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.h +++ b/include/deal.II/base/mpi_consensus_algorithms.h @@ -532,20 +532,15 @@ namespace Utilities const std::function()> &function_compute_targets, const std::function &)> - &function_create_request = - [](const unsigned int, std::vector &) {}, + &function_create_request = {}, const std::function &, std::vector &)> - &function_answer_request = [](const unsigned int, - const std::vector &, - std::vector &) {}, + &function_answer_request = {}, const std::function &)> - &function_prepare_buffer_for_answer = - [](const unsigned int, std::vector &) {}, + &function_prepare_buffer_for_answer = {}, const std::function &)> - &function_read_answer = - [](const unsigned int, const std::vector &) {}); + &function_read_answer = {}); /** * @copydoc Process::compute_targets() @@ -634,7 +629,8 @@ namespace Utilities AnonymousProcess::create_request(const unsigned int other_rank, std::vector & send_buffer) { - function_create_request(other_rank, send_buffer); + if (function_create_request) + function_create_request(other_rank, send_buffer); } @@ -646,7 +642,8 @@ namespace Utilities const std::vector &buffer_recv, std::vector & request_buffer) { - function_answer_request(other_rank, buffer_recv, request_buffer); + if (function_answer_request) + function_answer_request(other_rank, buffer_recv, request_buffer); } @@ -657,7 +654,8 @@ namespace Utilities const unsigned int other_rank, std::vector & recv_buffer) { - function_prepare_buffer_for_answer(other_rank, recv_buffer); + if (function_prepare_buffer_for_answer) + function_prepare_buffer_for_answer(other_rank, recv_buffer); } @@ -667,7 +665,8 @@ namespace Utilities AnonymousProcess::read_answer(const unsigned int other_rank, const std::vector &recv_buffer) { - function_read_answer(other_rank, recv_buffer); + if (function_read_answer) + function_read_answer(other_rank, recv_buffer); }