From 15310df954f16aa49d1431744029c4aef2fa693b Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 29 Jun 2023 10:05:41 -0400 Subject: [PATCH] Remove deprecations in consensus algorithms --- .../incompatibilities/20230629DanielArndt-1 | 6 + .../deal.II/base/mpi_consensus_algorithms.h | 317 +----------------- tests/mpi/compute_index_owner_01.cc | 4 +- 3 files changed, 9 insertions(+), 318 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20230629DanielArndt-1 diff --git a/doc/news/changes/incompatibilities/20230629DanielArndt-1 b/doc/news/changes/incompatibilities/20230629DanielArndt-1 new file mode 100644 index 0000000000..aa14c89cd2 --- /dev/null +++ b/doc/news/changes/incompatibilities/20230629DanielArndt-1 @@ -0,0 +1,6 @@ +Removed: Deprecated constructors for ConsensusAlgorithms::Interface, +ConsensusAlgorithms::Process, ConsensusAlgorithms::NBX, ConsensusAlgorithms::PEX, +ConsensusAlgorithms::Serial, ConsensusAlgorithms::Selector have been removed +as well as ConsensusAlgorithms::AnonymousProcess. +
+(Daniel Arndt, 2023/06/29) diff --git a/include/deal.II/base/mpi_consensus_algorithms.h b/include/deal.II/base/mpi_consensus_algorithms.h index 8f24df3370..05cf90a2b6 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.h +++ b/include/deal.II/base/mpi_consensus_algorithms.h @@ -237,23 +237,7 @@ namespace Utilities /** * Default constructor. */ - Interface(); - - /** - * Constructor. @p process is an object that provides information - * about what processes the current process wants to communicate with, - * and the data to be sent/received. @p comm is the communicator on - * which this communication is to happen. - * - * @deprecated This constructor stores the Process object and the - * communicator so that one can later call the run() function - * without arguments. This approach is deprecated. Instead, use - * the default constructor of this class along with the run() - * function that takes an argument. - */ - DEAL_II_DEPRECATED - Interface(Process &process, - const MPI_Comm comm); + Interface() = default; /** * Destructor. Made `virtual` to ensure that one can work with @@ -261,19 +245,6 @@ namespace Utilities */ virtual ~Interface() = default; - /** - * Run the consensus algorithm and return a vector of process ranks - * that have requested answers from the current process. - * - * @deprecated This function is deprecated. It can be called - * if the Process object and communicator to be used have previously - * been provided to the non-default constructor. Use the run() - * functions taking arguments instead. - */ - DEAL_II_DEPRECATED - std::vector - run(); - /** * Run the consensus algorithm and return a vector of process ranks * that have requested answers from the current process. @@ -317,26 +288,6 @@ namespace Utilities const std::function & process_answer, const MPI_Comm comm) = 0; - - private: - /** - * Reference to the process provided by the user. - * - * This member variable is only used in the deprecated constructor - * and the run() function without argument. It is a `nullptr` - * otherwise - */ - DEAL_II_DEPRECATED - Process *process; - - /** - * MPI communicator. - * - * This member variable is only used in the deprecated constructor - * and the run() function without argument. - */ - DEAL_II_DEPRECATED - MPI_Comm comm; }; @@ -362,21 +313,6 @@ namespace Utilities */ NBX() = default; - /** - * Constructor. - * - * @param process Process to be run during consensus algorithm. - * @param comm MPI Communicator - * - * @deprecated This constructor stores the Process object and the - * communicator so that one can later call the run() function - * without arguments. This approach is deprecated. Instead, use - * the default constructor of this class along with the run() - * function that takes an argument. - */ - DEAL_II_DEPRECATED - NBX(Process &process, const MPI_Comm comm); - /** * Destructor. */ @@ -627,22 +563,6 @@ namespace Utilities */ PEX() = default; - - /** - * Constructor. - * - * @param process Process to be run during consensus algorithm. - * @param comm MPI Communicator - * - * @deprecated This constructor stores the Process object and the - * communicator so that one can later call the run() function - * without arguments. This approach is deprecated. Instead, use - * the default constructor of this class along with the run() - * function that takes an argument. - */ - DEAL_II_DEPRECATED - PEX(Process &process, const MPI_Comm comm); - /** * Destructor. */ @@ -863,21 +783,6 @@ namespace Utilities */ Serial() = default; - /** - * Constructor. - * - * @param process Process to be run during consensus algorithm. - * @param comm MPI Communicator (ignored) - * - * @deprecated This constructor stores the Process object and the - * communicator so that one can later call the run() function - * without arguments. This approach is deprecated. Instead, use - * the default constructor of this class along with the run() - * function that takes an argument. - */ - DEAL_II_DEPRECATED - Serial(Process &process, const MPI_Comm comm); - // Import the declarations from the base class. using Interface::run; @@ -1001,22 +906,6 @@ namespace Utilities */ Selector() = default; - /** - * Constructor. - * - * @param process Process to be run during consensus algorithm. - * @param comm MPI Communicator. - * - * @deprecated This constructor stores the Process object and the - * communicator so that one can later call the run() function - * without arguments. This approach is deprecated. Instead, use - * the default constructor of this class along with the run() - * function that takes an argument. - */ - DEAL_II_DEPRECATED - Selector(Process &process, - const MPI_Comm comm); - /** * Destructor. */ @@ -1149,77 +1038,6 @@ namespace Utilities const MPI_Comm comm); - /** - * This class implements Utilities::MPI::ConsensusAlgorithms::Process, - * using user-provided function wrappers. - * The advantage of this class is that users do not have to write their - * own implementation but can register lambda functions directly. - */ - template - class DEAL_II_DEPRECATED AnonymousProcess - : public Process - { - public: - /** - * Register functions that should be called for implementing the - * interface of Process. - * - * @param function_compute_targets called during `compute_targets`. - * @param function_create_request called during `create_request`. - * @param function_answer_request called during `answer_request`. - * @param function_read_answer called during `read_answer`. - */ - AnonymousProcess( - const std::function()> - &function_compute_targets, - const std::function - & function_create_request = {}, - const std::function &function_answer_request = {}, - const std::function - &function_read_answer = {}); - - /** - * @copydoc Process::compute_targets() - */ - std::vector - compute_targets() override; - - /** - * @copydoc Process::create_request() - */ - void - create_request(const unsigned int other_rank, - RequestType & send_buffer) override; - - /** - * @copydoc Process::answer_request() - */ - void - answer_request(const unsigned int other_rank, - const RequestType &buffer_recv, - AnswerType & request_buffer) override; - - /** - * @copydoc Process::read_answer() - */ - void - read_answer(const unsigned int other_rank, - const AnswerType & recv_buffer) override; - - private: - const std::function()> - function_compute_targets; - const std::function - function_create_request; - const std::function< - void(const unsigned int, const RequestType &, AnswerType &)> - function_answer_request; - const std::function - function_read_answer; - }; - #ifndef DOXYGEN // Implementation of the functions in this namespace. @@ -1434,71 +1252,6 @@ namespace Utilities comm); } - - - template - AnonymousProcess::AnonymousProcess( - const std::function()> - &function_compute_targets, - const std::function - & function_create_request, - const std::function &function_answer_request, - const std::function - &function_read_answer) - : function_compute_targets(function_compute_targets) - , function_create_request(function_create_request) - , function_answer_request(function_answer_request) - , function_read_answer(function_read_answer) - {} - - - - template - std::vector - AnonymousProcess::compute_targets() - { - return function_compute_targets(); - } - - - - template - void - AnonymousProcess::create_request( - const unsigned int other_rank, - RequestType & send_buffer) - { - if (function_create_request) - function_create_request(other_rank, send_buffer); - } - - - - template - void - AnonymousProcess::answer_request( - const unsigned int other_rank, - const RequestType &buffer_recv, - AnswerType & request_buffer) - { - if (function_answer_request) - function_answer_request(other_rank, buffer_recv, request_buffer); - } - - - - template - void - AnonymousProcess::read_answer( - const unsigned int other_rank, - const AnswerType & recv_buffer) - { - if (function_read_answer) - function_read_answer(other_rank, recv_buffer); - } - #endif @@ -1661,38 +1414,6 @@ namespace Utilities - template - Interface::Interface( - Process &process, - const MPI_Comm comm) - : process(&process) - , comm(comm) - {} - - - - template - Interface::Interface() - : process(nullptr) - , comm(MPI_COMM_NULL) - {} - - - - template - std::vector - Interface::run() - { - Assert(process != nullptr, - ExcMessage("This function can only be called if the " - "deprecated non-default constructor of this class " - "has previously been called to set the Process " - "object and a communicator.")); - return run(*process, comm); - } - - - template std::vector Interface::run( @@ -1724,15 +1445,6 @@ namespace Utilities - template - NBX::NBX( - Process &process, - const MPI_Comm comm) - : Interface(process, comm) - {} - - - template std::vector NBX::run( @@ -2104,15 +1816,6 @@ namespace Utilities - template - PEX::PEX( - Process &process, - const MPI_Comm comm) - : Interface(process, comm) - {} - - - template std::vector PEX::run( @@ -2384,15 +2087,6 @@ namespace Utilities - template - Serial::Serial( - Process &process, - const MPI_Comm comm) - : Interface(process, comm) - {} - - - template std::vector Serial::run( @@ -2437,15 +2131,6 @@ namespace Utilities - template - Selector::Selector( - Process &process, - const MPI_Comm comm) - : Interface(process, comm) - {} - - - template std::vector Selector::run( diff --git a/tests/mpi/compute_index_owner_01.cc b/tests/mpi/compute_index_owner_01.cc index cbb6cdb05d..7eaf5f3f9a 100644 --- a/tests/mpi/compute_index_owner_01.cc +++ b/tests/mpi/compute_index_owner_01.cc @@ -63,8 +63,8 @@ test() Utilities::MPI::ConsensusAlgorithms::Selector< std::vector>, std::vector> - consensus_algorithm(process, comm); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, comm); deallog << "owning_ranks_of_ghosts:" << std::endl; for (auto i : owning_ranks_of_ghosts) -- 2.39.5