]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove deprecations in consensus algorithms 15529/head
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 29 Jun 2023 14:05:41 +0000 (10:05 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Fri, 30 Jun 2023 19:15:29 +0000 (15:15 -0400)
doc/news/changes/incompatibilities/20230629DanielArndt-1 [new file with mode: 0644]
include/deal.II/base/mpi_consensus_algorithms.h
tests/mpi/compute_index_owner_01.cc

diff --git a/doc/news/changes/incompatibilities/20230629DanielArndt-1 b/doc/news/changes/incompatibilities/20230629DanielArndt-1
new file mode 100644 (file)
index 0000000..aa14c89
--- /dev/null
@@ -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.
+<br>
+(Daniel Arndt, 2023/06/29)
index 8f24df3370dfd9e6e6bc0f43f1c8b9bd3d8d7db1..05cf90a2b6ff67482939fbb3e621d1a8047b1de3 100644 (file)
@@ -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<RequestType, AnswerType> &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<unsigned int>
-        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<void(const unsigned int, const AnswerType &)>
             &            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<RequestType, AnswerType> *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<RequestType, AnswerType> &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<RequestType, AnswerType> &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<RequestType, AnswerType> &process, const MPI_Comm comm);
-
         // Import the declarations from the base class.
         using Interface<RequestType, AnswerType>::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<RequestType, AnswerType> &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 <typename RequestType, typename AnswerType>
-      class DEAL_II_DEPRECATED AnonymousProcess
-        : public Process<RequestType, AnswerType>
-      {
-      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<std::vector<unsigned int>()>
-            &function_compute_targets,
-          const std::function<void(const unsigned int, RequestType &)>
-            &                                      function_create_request = {},
-          const std::function<void(const unsigned int,
-                                   const RequestType &,
-                                   AnswerType &)> &function_answer_request = {},
-          const std::function<void(const unsigned int, const AnswerType &)>
-            &function_read_answer = {});
-
-        /**
-         * @copydoc Process::compute_targets()
-         */
-        std::vector<unsigned int>
-        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<std::vector<unsigned int>()>
-          function_compute_targets;
-        const std::function<void(const int, RequestType &)>
-          function_create_request;
-        const std::function<
-          void(const unsigned int, const RequestType &, AnswerType &)>
-          function_answer_request;
-        const std::function<void(const int, const AnswerType &)>
-          function_read_answer;
-      };
-
 
 #ifndef DOXYGEN
       // Implementation of the functions in this namespace.
@@ -1434,71 +1252,6 @@ namespace Utilities
           comm);
       }
 
-
-
-      template <typename RequestType, typename AnswerType>
-      AnonymousProcess<RequestType, AnswerType>::AnonymousProcess(
-        const std::function<std::vector<unsigned int>()>
-          &function_compute_targets,
-        const std::function<void(const unsigned int, RequestType &)>
-          &                                      function_create_request,
-        const std::function<void(const unsigned int,
-                                 const RequestType &,
-                                 AnswerType &)> &function_answer_request,
-        const std::function<void(const unsigned int, const AnswerType &)>
-          &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 <typename RequestType, typename AnswerType>
-      std::vector<unsigned int>
-      AnonymousProcess<RequestType, AnswerType>::compute_targets()
-      {
-        return function_compute_targets();
-      }
-
-
-
-      template <typename RequestType, typename AnswerType>
-      void
-      AnonymousProcess<RequestType, AnswerType>::create_request(
-        const unsigned int other_rank,
-        RequestType &      send_buffer)
-      {
-        if (function_create_request)
-          function_create_request(other_rank, send_buffer);
-      }
-
-
-
-      template <typename RequestType, typename AnswerType>
-      void
-      AnonymousProcess<RequestType, AnswerType>::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 <typename RequestType, typename AnswerType>
-      void
-      AnonymousProcess<RequestType, AnswerType>::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 <typename RequestType, typename AnswerType>
-      Interface<RequestType, AnswerType>::Interface(
-        Process<RequestType, AnswerType> &process,
-        const MPI_Comm                    comm)
-        : process(&process)
-        , comm(comm)
-      {}
-
-
-
-      template <typename RequestType, typename AnswerType>
-      Interface<RequestType, AnswerType>::Interface()
-        : process(nullptr)
-        , comm(MPI_COMM_NULL)
-      {}
-
-
-
-      template <typename RequestType, typename AnswerType>
-      std::vector<unsigned int>
-      Interface<RequestType, AnswerType>::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 <typename RequestType, typename AnswerType>
       std::vector<unsigned int>
       Interface<RequestType, AnswerType>::run(
@@ -1724,15 +1445,6 @@ namespace Utilities
 
 
 
-      template <typename RequestType, typename AnswerType>
-      NBX<RequestType, AnswerType>::NBX(
-        Process<RequestType, AnswerType> &process,
-        const MPI_Comm                    comm)
-        : Interface<RequestType, AnswerType>(process, comm)
-      {}
-
-
-
       template <typename RequestType, typename AnswerType>
       std::vector<unsigned int>
       NBX<RequestType, AnswerType>::run(
@@ -2104,15 +1816,6 @@ namespace Utilities
 
 
 
-      template <typename RequestType, typename AnswerType>
-      PEX<RequestType, AnswerType>::PEX(
-        Process<RequestType, AnswerType> &process,
-        const MPI_Comm                    comm)
-        : Interface<RequestType, AnswerType>(process, comm)
-      {}
-
-
-
       template <typename RequestType, typename AnswerType>
       std::vector<unsigned int>
       PEX<RequestType, AnswerType>::run(
@@ -2384,15 +2087,6 @@ namespace Utilities
 
 
 
-      template <typename RequestType, typename AnswerType>
-      Serial<RequestType, AnswerType>::Serial(
-        Process<RequestType, AnswerType> &process,
-        const MPI_Comm                    comm)
-        : Interface<RequestType, AnswerType>(process, comm)
-      {}
-
-
-
       template <typename RequestType, typename AnswerType>
       std::vector<unsigned int>
       Serial<RequestType, AnswerType>::run(
@@ -2437,15 +2131,6 @@ namespace Utilities
 
 
 
-      template <typename RequestType, typename AnswerType>
-      Selector<RequestType, AnswerType>::Selector(
-        Process<RequestType, AnswerType> &process,
-        const MPI_Comm                    comm)
-        : Interface<RequestType, AnswerType>(process, comm)
-      {}
-
-
-
       template <typename RequestType, typename AnswerType>
       std::vector<unsigned int>
       Selector<RequestType, AnswerType>::run(
index cbb6cdb05d8227a10a53b57ea4d9a94927548346..7eaf5f3f9a71560fc28e447e88048299e02dfc73 100644 (file)
@@ -63,8 +63,8 @@ test()
     Utilities::MPI::ConsensusAlgorithms::Selector<
       std::vector<std::pair<types::global_dof_index, types::global_dof_index>>,
       std::vector<unsigned int>>
-      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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.