From: Wolfgang Bangerth Date: Sat, 26 Feb 2022 21:43:16 +0000 (-0700) Subject: Adjust a test to use the free function interface. X-Git-Tag: v9.4.0-rc1~259^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfa23206d7b3b27102712176677406c170676995;p=dealii.git Adjust a test to use the free function interface. --- diff --git a/tests/base/consensus_algorithm_01.cc b/tests/base/consensus_algorithm_01.cc index af64ddd2b0..7f91866e2a 100644 --- a/tests/base/consensus_algorithm_01.cc +++ b/tests/base/consensus_algorithm_01.cc @@ -14,7 +14,7 @@ // --------------------------------------------------------------------- -// Test ConsensusAlgorithms::AnonymousProcess. +// Test ConsensusAlgorithms::selection(). #include @@ -30,31 +30,26 @@ test(const MPI_Comm &comm) using T1 = unsigned int; using T2 = unsigned int; - dealii::Utilities::MPI::ConsensusAlgorithms::AnonymousProcess process( - [&]() { - std::vector result{(my_rank + 1) % n_rank}; - return result; - }, - [&](const unsigned int other_rank, std::vector &send_buffer) { - send_buffer.push_back(my_rank); - }, - [&](const unsigned int & other_rank, - const std::vector &buffer_recv, - std::vector & request_buffer) { - AssertDimension(other_rank, buffer_recv.front()); - deallog << "ConsensusAlgorithmProcess::answer_request() passed!" - << std::endl; - request_buffer.push_back(my_rank); - }, - [&](const unsigned int other_rank, const std::vector &recv_buffer) { - AssertDimension(other_rank, recv_buffer.front()); - deallog << "ConsensusAlgorithmProcess::function_read_answer() passed!" - << std::endl; - }); - const auto sources = - dealii::Utilities::MPI::ConsensusAlgorithms::Selector(process, comm) - .run(); + dealii::Utilities::MPI::ConsensusAlgorithms::selector( + /* target_processes: */ + std::vector{(my_rank + 1) % n_rank}, + /* create_request: */ + [my_rank](const unsigned int) { return std::vector({my_rank}); }, + /* answer_request: */ + [my_rank](const unsigned int other_rank, const std::vector &request) { + AssertDimension(other_rank, request.front()); + deallog << "ConsensusAlgorithmProcess::answer_request() passed!" + << std::endl; + return std::vector({my_rank}); + }, + /* process_answer: */ + [](const unsigned int other_rank, const std::vector &answer) { + AssertDimension(other_rank, answer.front()); + deallog << "ConsensusAlgorithmProcess::function_read_answer() passed!" + << std::endl; + }, + comm); for (const auto &i : sources) deallog << i << ' ';