![]() |
deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
|
#include <deal.II/base/mpi_consensus_algorithms.h>
A class which delegates its task to other ConsensusAlgorithms::Interface implementations depending on the number of processes in the MPI communicator. For a small number of processes it uses PEX and for a large number of processes NBX. The threshold depends if the program is compiled in debug or release mode, but the goal is to always use the most efficient algorithm for however many processes participate in the communication.
| RequestType | The type of the elements of the vector to be sent. |
| AnswerType | The type of the elements of the vector to be received. |
Definition at line 793 of file mpi_consensus_algorithms.h.
Public Member Functions | |
| Selector ()=default | |
| virtual | ~Selector ()=default |
| virtual std::vector< unsigned int > | run (const std::vector< unsigned int > &targets, const std::function< RequestType(const unsigned int)> &create_request, const std::function< AnswerType(const unsigned int, const RequestType &)> &answer_request, const std::function< void(const unsigned int, const AnswerType &)> &process_answer, const MPI_Comm comm) override |
Private Attributes | |
| std::shared_ptr< Interface< RequestType, AnswerType > > | consensus_algo |
|
default |
Default constructor.
|
virtualdefault |
Destructor.
|
overridevirtual |
Run the consensus algorithm and return a vector of process ranks that have requested answers from the current process.
| [in] | targets | A vector that contains the ranks of processes to which requests should be sent and from which answers need to be received. |
| [in] | create_request | A function object that takes the rank of a target process as argument and returns the message that forms the request to this target. |
| [in] | answer_request | A function that takes as arguments the rank of the process that has sent a request to us, along with the message of the request, and returns the message that forms the answer that should be sent back to the requesting process. |
| [in] | process_answer | A function object that takes as argument the rank of a process from which we have received an answer to a previously sent request, along with the message that forms this answer. This function is used to describe what the caller of the consensus algorithm wants to do with the received answer. |
| [in] | comm | The MPI communicator on which the whole algorithm is to be performed. |
Implements Utilities::MPI::ConsensusAlgorithms::Interface< RequestType, AnswerType >.
|
private |
Definition at line 823 of file mpi_consensus_algorithms.h.