deal.II version GIT relicensing-2167-g9622207b8f 2024-11-21 12:40:00+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 | List of all members
Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType > Class Template Referenceabstract

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

Public Member Functions

virtual ~Process ()=default
 
virtual std::vector< unsigned intcompute_targets ()=0
 
virtual void create_request (const unsigned int other_rank, RequestType &send_buffer)
 
virtual void answer_request (const unsigned int other_rank, const RequestType &buffer_recv, AnswerType &request_buffer)
 
virtual void read_answer (const unsigned int other_rank, const AnswerType &recv_buffer)
 

Detailed Description

template<typename RequestType, typename AnswerType>
class Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType >

A base class for concrete implementations of classes that provide the information that the algorithms derived from the ConsensusAlgorithms::Interface base class require. The main functionality of this class is to return a list of process ranks this process wants data from and to deal with the optional payload of the messages sent/received by the ConsensusAlgorithm classes.

There are two kinds of messages:

Template Parameters
RequestTypeThe type of the elements of the vector to sent.
AnswerTypeThe type of the elements of the vector to received.
Note
Since the payloads of the messages are optional, users have to deal with buffers themselves. The ConsensusAlgorithm classes (1) deliver only references to empty vectors (of size 0) the data to be sent can be inserted to or read from, and (2) communicate these vectors blindly.
Deprecated:
Instead of deriving a class from this base class and providing a corresponding object to one of the run() functions, use the free functions in this namespace that take function objects as arguments.

Definition at line 161 of file mpi_consensus_algorithms.h.

Constructor & Destructor Documentation

◆ ~Process()

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

Destructor. Made virtual to ensure that one can work with derived classes.

Member Function Documentation

◆ compute_targets()

template<typename RequestType , typename AnswerType >
virtual std::vector< unsigned int > Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType >::compute_targets ( )
pure virtual
Returns
A vector of ranks this process wants to send a request to.
Note
This is the only method which has to be implemented since the payloads of the messages are optional.

◆ create_request()

template<typename RequestType , typename AnswerType >
virtual void Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType >::create_request ( const unsigned int  other_rank,
RequestType &  send_buffer 
)
virtual

Add a payload to the request to the process with the specified rank.

Parameters
[in]other_rankRank of the process.
[out]send_bufferdata to be sent part of the request (optional).
Note
The buffer is empty. Before using it, you have to set its size.

◆ answer_request()

template<typename RequestType , typename AnswerType >
virtual void Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType >::answer_request ( const unsigned int  other_rank,
const RequestType &  buffer_recv,
AnswerType &  request_buffer 
)
virtual

Prepare the buffer where the payload of the answer of the request to the process with the specified rank is saved in.

Parameters
[in]other_rankRank of the process.
[in]buffer_recvReceived payload (optional).
[out]request_bufferPayload to be sent as part of the request (optional).
Note
The request_buffer is empty. Before using it, you have to set its size.

◆ read_answer()

template<typename RequestType , typename AnswerType >
virtual void Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType >::read_answer ( const unsigned int  other_rank,
const AnswerType &  recv_buffer 
)
virtual

Process the payload of the answer of the request to the process with the specified rank.

Parameters
[in]other_rankrank of the process
[in]recv_bufferdata to be sent part of the request (optional)

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