Reference documentation for deal.II version 9.5.0
\(\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::AnonymousProcess< RequestType, AnswerType > Class Template Reference

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

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

Public Member Functions

 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={})
 
std::vector< unsigned intcompute_targets () override
 
void create_request (const unsigned int other_rank, RequestType &send_buffer) override
 
void answer_request (const unsigned int other_rank, const RequestType &buffer_recv, AnswerType &request_buffer) override
 
void read_answer (const unsigned int other_rank, const AnswerType &recv_buffer) override
 

Private Attributes

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
 

Detailed Description

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

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.

Definition at line 1159 of file mpi_consensus_algorithms.h.

Constructor & Destructor Documentation

◆ AnonymousProcess()

template<typename RequestType , typename AnswerType >
Utilities::MPI::ConsensusAlgorithms::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 = {} 
)

Register functions that should be called for implementing the interface of Process.

Parameters
function_compute_targetscalled during compute_targets.
function_create_requestcalled during create_request.
function_answer_requestcalled during answer_request.
function_read_answercalled during read_answer.

Member Function Documentation

◆ compute_targets()

template<typename RequestType , typename AnswerType >
std::vector< unsigned int > Utilities::MPI::ConsensusAlgorithms::AnonymousProcess< RequestType, AnswerType >::compute_targets ( )
overridevirtual

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.

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

◆ create_request()

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

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.

Reimplemented from Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType >.

◆ answer_request()

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

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.

Reimplemented from Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType >.

◆ read_answer()

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

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)

Reimplemented from Utilities::MPI::ConsensusAlgorithms::Process< RequestType, AnswerType >.

Member Data Documentation

◆ function_compute_targets

template<typename RequestType , typename AnswerType >
const std::function<std::vector<unsigned int>()> Utilities::MPI::ConsensusAlgorithms::AnonymousProcess< RequestType, AnswerType >::function_compute_targets
private

Definition at line 1213 of file mpi_consensus_algorithms.h.

◆ function_create_request

template<typename RequestType , typename AnswerType >
const std::function<void(const int, RequestType &)> Utilities::MPI::ConsensusAlgorithms::AnonymousProcess< RequestType, AnswerType >::function_create_request
private

Definition at line 1215 of file mpi_consensus_algorithms.h.

◆ function_answer_request

template<typename RequestType , typename AnswerType >
const std::function< void(const unsigned int, const RequestType &, AnswerType &)> Utilities::MPI::ConsensusAlgorithms::AnonymousProcess< RequestType, AnswerType >::function_answer_request
private

Definition at line 1218 of file mpi_consensus_algorithms.h.

◆ function_read_answer

template<typename RequestType , typename AnswerType >
const std::function<void(const int, const AnswerType &)> Utilities::MPI::ConsensusAlgorithms::AnonymousProcess< RequestType, AnswerType >::function_read_answer
private

Definition at line 1220 of file mpi_consensus_algorithms.h.


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