Reference documentation for deal.II version GIT relicensing-487-ge9eb5ab491 2024-04-25 07:20:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Utilities::MPI::ConsensusAlgorithms::Selector< RequestType, AnswerType > Class Template Reference

#include <deal.II/base/mpi_consensus_algorithms.h>

Inheritance diagram for Utilities::MPI::ConsensusAlgorithms::Selector< RequestType, AnswerType >:
Inheritance graph
[legend]

Public Member Functions

 Selector ()=default
 
virtual ~Selector ()=default
 
virtual std::vector< unsigned intrun (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
 
std::vector< unsigned intrun (Process< RequestType, AnswerType > &process, const MPI_Comm comm)
 

Private Attributes

std::shared_ptr< Interface< RequestType, AnswerType > > consensus_algo
 

Detailed Description

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
RequestTypeThe type of the elements of the vector to be sent.
AnswerTypeThe type of the elements of the vector to be received.

Definition at line 900 of file mpi_consensus_algorithms.h.

Constructor & Destructor Documentation

◆ Selector()

template<typename RequestType , typename AnswerType >
Utilities::MPI::ConsensusAlgorithms::Selector< RequestType, AnswerType >::Selector ( )
default

Default constructor.

◆ ~Selector()

template<typename RequestType , typename AnswerType >
virtual Utilities::MPI::ConsensusAlgorithms::Selector< RequestType, AnswerType >::~Selector ( )
virtualdefault

Destructor.

Member Function Documentation

◆ run() [1/2]

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.

Note
The function call is delegated to another ConsensusAlgorithms::Interface implementation.

Implements Utilities::MPI::ConsensusAlgorithms::Interface< RequestType, AnswerType >.

◆ run() [2/2]

template<typename RequestType , typename AnswerType >
std::vector< unsigned int > Utilities::MPI::ConsensusAlgorithms::Interface< RequestType, AnswerType >::run ( Process< RequestType, AnswerType > &  process,
const MPI_Comm  comm 
)
inherited

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.

Member Data Documentation

◆ consensus_algo

template<typename RequestType , typename AnswerType >
std::shared_ptr<Interface<RequestType, AnswerType> > Utilities::MPI::ConsensusAlgorithms::Selector< RequestType, AnswerType >::consensus_algo
private

Definition at line 933 of file mpi_consensus_algorithms.h.


The documentation for this class was generated from the following file: