template<typename RequestType, typename AnswerType>
class Utilities::MPI::ConsensusAlgorithms::Selector< RequestType, AnswerType >
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.
- Template Parameters
-
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 909 of file mpi_consensus_algorithms.h.
template<typename RequestType , typename AnswerType >
virtual std::vector< unsigned int > Utilities::MPI::ConsensusAlgorithms::Selector< RequestType, AnswerType >::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 |
|
) |
| |
|
overridevirtual |
Run the consensus algorithm and return a vector of process ranks that have requested answers from the current process.
This version of the run() function simply unpacks the functions packaged in process
and calls the version of the run() function that takes a number of std::function
arguments.
- Deprecated:
- Instead of deriving a class from the Process base class and providing a corresponding object to this function, use the other run() function in this class that takes function objects as arguments.
- Note
- The function call is delegated to another ConsensusAlgorithms::Interface implementation.
Implements Utilities::MPI::ConsensusAlgorithms::Interface< RequestType, AnswerType >.