Chi-Tech
CBC_AsyncComm.h
Go to the documentation of this file.
1#ifndef CHITECH_CBC_ASYNCCOMM_H
2#define CHITECH_CBC_ASYNCCOMM_H
3
4#include <cstdint>
5#include <cstddef>
6#include <map>
7#include <vector>
8
10
11#include "chi_mpi.h"
13
14namespace chi
15{
16class ChiMPICommunicatorSet;
17}
18
19namespace chi_data_types
20{
21class ByteArray;
22}
23
24namespace lbs
25{
26
27class CBC_FLUDS;
28
31{
32public:
34 size_t angle_set_id,
36 const chi::ChiMPICommunicatorSet& comm_set);
37
38 // location_id
39 // cell_global_id
40 // face_id
41 typedef std::tuple<int, uint64_t, unsigned int> MessageKey;
42
43 std::vector<double>& InitGetDownwindMessageData(int location_id,
44 uint64_t cell_global_id,
45 unsigned int face_id,
46 size_t angle_set_id,
47 size_t data_size) override;
48
49 bool SendData();
50 std::vector<uint64_t> ReceiveData();
51
52 void Reset()
53 {
55 send_buffer_.clear();
56 }
57
58protected:
59 const size_t angle_set_id_;
61 std::map<MessageKey, std::vector<double>> outgoing_message_queue_;
62
64 {
65 int destination_ = 0;
66 MPI_Request mpi_request_ = 0;
67 bool send_initiated_ = false;
68 bool completed_ = false;
70 };
71 std::vector<BufferItem> send_buffer_;
72};
73
74} // namespace lbs
75
76#endif // CHITECH_CBC_ASYNCCOMM_H
CBC_ASynchronousCommunicator(size_t angle_set_id, chi_mesh::sweep_management::FLUDS &fluds, const chi::ChiMPICommunicatorSet &comm_set)
std::vector< BufferItem > send_buffer_
Definition: CBC_AsyncComm.h:71
std::vector< uint64_t > ReceiveData()
std::vector< double > & InitGetDownwindMessageData(int location_id, uint64_t cell_global_id, unsigned int face_id, size_t angle_set_id, size_t data_size) override
std::tuple< int, uint64_t, unsigned int > MessageKey
Definition: CBC_AsyncComm.h:41
std::map< MessageKey, std::vector< double > > outgoing_message_queue_
Definition: CBC_AsyncComm.h:61