|
Reference documentation for deal.II version 9.2.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\}}\)
Go to the documentation of this file.
16 #ifndef dealii_mpi_consensus_algorithm_h
17 #define dealii_mpi_consensus_algorithm_h
22 #include <deal.II/base/mpi.templates.h>
37 namespace ConsensusAlgorithms
63 template <
typename T1,
typename T2>
78 virtual std::vector<unsigned int>
92 std::vector<T1> & send_buffer);
106 std::vector<T2> & recv_buffer);
122 const std::vector<T1> &buffer_recv,
123 std::vector<T2> & request_buffer);
134 const std::vector<T2> &recv_buffer);
169 template <
typename T1,
typename T2>
227 template <
typename T1,
typename T2>
242 virtual ~NBX() =
default;
251 #ifdef DEAL_II_WITH_MPI
366 template <
typename T1,
typename T2>
381 virtual ~PEX() =
default;
390 #ifdef DEAL_II_WITH_MPI
463 template <
typename T1,
typename T2>
499 template <
typename T1,
typename T2>
515 const std::function<std::vector<unsigned int>()>
517 const std::function<
void(
const unsigned int, std::vector<T1> &)>
519 [](
const unsigned int, std::vector<T1> &) {},
520 const std::function<void(
const unsigned int,
521 const std::vector<T1> &,
524 const std::vector<T1> &,
525 std::vector<T2> &) {},
526 const std::function<void(
const unsigned int, std::vector<T2> &)>
528 [](
const unsigned int, std::vector<T2> &) {},
529 const std::function<void(
const unsigned int,
const std::vector<T2> &)>
531 [](
const unsigned int,
const std::vector<T2> &) {});
536 std::vector<unsigned int>
544 std::vector<T1> & send_buffer)
override;
551 const std::vector<T1> &buffer_recv,
552 std::vector<T2> & request_buffer)
override;
559 std::vector<T2> & recv_buffer)
override;
566 const std::vector<T2> &recv_buffer)
override;
569 const std::function<std::vector<unsigned int>()>
571 const std::function<void(
const int, std::vector<T1> &)>
574 void(
const unsigned int,
const std::vector<T1> &, std::vector<T2> &)>
576 const std::function<void(
const int, std::vector<T2> &)>
578 const std::function<void(
const int,
const std::vector<T2> &)>
584 template <
typename T1,
typename T2>
586 const std::function<std::vector<unsigned int>()>
587 &function_compute_targets,
588 const std::function<
void(
const unsigned int, std::vector<T1> &)>
589 & function_create_request,
590 const std::function<
void(
const unsigned int,
591 const std::vector<T1> &,
592 std::vector<T2> &)> &function_answer_request,
593 const std::function<
void(
const unsigned int, std::vector<T2> &)>
594 &function_prepare_buffer_for_answer,
595 const std::function<
void(
const unsigned int,
const std::vector<T2> &)>
596 &function_read_answer)
597 : function_compute_targets(function_compute_targets)
598 , function_create_request(function_create_request)
599 , function_answer_request(function_answer_request)
600 , function_prepare_buffer_for_answer(function_prepare_buffer_for_answer)
601 , function_read_answer(function_read_answer)
606 template <
typename T1,
typename T2>
607 std::vector<unsigned int>
610 return function_compute_targets();
615 template <
typename T1,
typename T2>
618 std::vector<T1> & send_buffer)
620 function_create_request(other_rank, send_buffer);
625 template <
typename T1,
typename T2>
628 const unsigned int other_rank,
629 const std::vector<T1> &buffer_recv,
630 std::vector<T2> & request_buffer)
632 function_answer_request(other_rank, buffer_recv, request_buffer);
637 template <
typename T1,
typename T2>
640 const unsigned int other_rank,
641 std::vector<T2> & recv_buffer)
643 function_prepare_buffer_for_answer(other_rank, recv_buffer);
648 template <
typename T1,
typename T2>
651 const std::vector<T2> &recv_buffer)
653 function_read_answer(other_rank, recv_buffer);
virtual std::vector< unsigned int > compute_targets()=0
virtual ~Interface()=default
void clean_up_and_end_communication()
virtual ~Process()=default
const std::function< void(const unsigned int, const std::vector< T1 > &, std::vector< T2 > &)> function_answer_request
std::shared_ptr< Interface< T1, T2 > > consensus_algo
std::vector< MPI_Request > send_and_recv_buffers
std::vector< unsigned int > targets
const std::function< void(const int, std::vector< T1 > &)> function_create_request
Interface(Process< T1, T2 > &process, const MPI_Comm &comm)
std::vector< MPI_Request > send_requests
void read_answer(const unsigned int other_rank, const std::vector< T2 > &recv_buffer) override
std::vector< std::unique_ptr< std::vector< T2 > > > request_buffers
virtual void read_answer(const unsigned int other_rank, const std::vector< T2 > &recv_buffer)
void prepare_buffer_for_answer(const unsigned int other_rank, std::vector< T2 > &recv_buffer) override
AnonymousProcess(const std::function< std::vector< unsigned int >()> &function_compute_targets, const std::function< void(const unsigned int, std::vector< T1 > &)> &function_create_request=[](const unsigned int, std::vector< T1 > &) {}, const std::function< void(const unsigned int, const std::vector< T1 > &, std::vector< T2 > &)> &function_answer_request=[](const unsigned int, const std::vector< T1 > &, std::vector< T2 > &) {}, const std::function< void(const unsigned int, std::vector< T2 > &)> &function_prepare_buffer_for_answer=[](const unsigned int, std::vector< T2 > &) {}, const std::function< void(const unsigned int, const std::vector< T2 > &)> &function_read_answer=[](const unsigned int, const std::vector< T2 > &) {})
virtual void prepare_buffer_for_answer(const unsigned int other_rank, std::vector< T2 > &recv_buffer)
void answer_request(const unsigned int other_rank, const std::vector< T1 > &buffer_recv, std::vector< T2 > &request_buffer) override
Process< T1, T2 > & process
std::vector< MPI_Request > recv_requests
#define DEAL_II_NAMESPACE_OPEN
virtual ~Selector()=default
unsigned int start_communication()
std::vector< unsigned int > sources
MPI_Request barrier_request
virtual void run() override
std::vector< std::vector< T1 > > send_buffers
const std::function< void(const int, std::vector< T2 > &)> function_prepare_buffer_for_answer
std::vector< std::vector< T1 > > send_buffers
virtual void create_request(const unsigned int other_rank, std::vector< T1 > &send_buffer)
void create_request(const unsigned int other_rank, std::vector< T1 > &send_buffer) override
virtual void run() override
PEX(Process< T1, T2 > &process, const MPI_Comm &comm)
NBX(Process< T1, T2 > &process, const MPI_Comm &comm)
std::vector< std::vector< T2 > > recv_buffers
std::vector< MPI_Request > requests_answers
std::vector< unsigned int > compute_targets() override
bool check_global_state()
virtual void run() override
const std::function< std::vector< unsigned int >)> function_compute_targets
Selector(Process< T1, T2 > &process, const MPI_Comm &comm)
std::set< unsigned int > requesting_processes
std::vector< std::vector< T2 > > requests_buffers
std::vector< std::vector< T2 > > recv_buffers
#define DEAL_II_NAMESPACE_CLOSE
void clean_up_and_end_communication()
std::vector< std::unique_ptr< MPI_Request > > request_requests
void start_communication()
const unsigned int n_procs
void answer_requests(int index)
virtual void answer_request(const unsigned int other_rank, const std::vector< T1 > &buffer_recv, std::vector< T2 > &request_buffer)
const std::function< void(const int, const std::vector< T2 > &)> function_read_answer
std::vector< unsigned int > targets
const unsigned int my_rank