Chi-Tech
AAH_AsynComm_general.cc
Go to the documentation of this file.
1#include "AAH_AsynComm.h"
2
5
6// ###################################################################
7/**Constructor.*/
10 size_t num_groups,
11 size_t num_angles,
12 int sweep_eager_limit,
13 const chi::ChiMPICommunicatorSet& in_comm_set)
14 : AsynchronousCommunicator(fluds, in_comm_set),
15 num_groups_(num_groups),
16 num_angles_(num_angles)
17{
18 done_sending = false;
19 data_initialized = false;
21 EAGER_LIMIT = sweep_eager_limit;
22
23 max_num_mess = 0;
24
26}
27
28// ###################################################################
29/**Returns the private flag done_sending.*/
31 const
32{
33 return done_sending;
34}
35
36// ###################################################################
37/**Receive all upstream Psi. This method is called from within
38 * an advancement of an angleset, right after execution.*/
41{
42 fluds_.ClearLocalAndReceivePsi();
43}
44
45// ###################################################################
46/**Sends downstream psi.*/
49{
50 if (done_sending) return;
51
52 done_sending = true;
53 for (auto& locI_requests : deplocI_message_request)
54 for (auto& request : locI_requests)
55 {
56 int message_sent;
57 MPI_Test(&request, &message_sent, MPI_STATUS_IGNORE);
58 if (not message_sent)
59 {
60 done_sending = false;
61 return;
62 }
63 }
64
65 if (done_sending) fluds_.ClearSendPsi();
66}
67
68// ###################################################################
69/**Clear flags in preperation for another sweep.*/
71{
72 done_sending = false;
73 data_initialized = false;
74 upstream_data_initialized = false;
75
76 for (auto& message_flags : prelocI_message_received)
77 message_flags.assign(message_flags.size(), false);
78
79 for (auto& message_flags : delayed_prelocI_message_received)
80 message_flags.assign(message_flags.size(), false);
81}
AAH_ASynchronousCommunicator(FLUDS &fluds, size_t num_groups, size_t num_angles, int sweep_eager_limit, const chi::ChiMPICommunicatorSet &in_comm_set)