]> AND Private Git Repository - loba.git/blob - process.h
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Improved description for valgrind suppression.
[loba.git] / process.h
1 #ifndef PROCESS_H
2 #define PROCESS_H
3
4 #define USE_UNORDERED_MAP 1
5 //#undef USE_UNORDERED_MAP
6
7 #include <vector>
8 #ifdef USE_UNORDERED_MAP
9 #  include <tr1/unordered_map>
10 #  define MAP_TEMPLATE std::tr1::unordered_map
11 #else
12 #  include <map>
13 #  define MAP_TEMPLATE std::map
14 #endif
15 #include <msg/msg.h>
16 #include "communicator.h"
17 #include "neighbor.h"
18
19 class process {
20 public:
21     process(int argc, char* argv[]);
22     ~process();
23     int run();
24
25 protected:
26     typedef std::vector<neighbor> neigh_type;
27     typedef std::vector<neighbor*> pneigh_type;
28
29     neigh_type neigh;
30     pneigh_type pneigh;
31
32 private:
33     typedef MAP_TEMPLATE<m_host_t, neighbor*> rev_neigh_type;
34     enum recv_wait_mode { NO_WAIT = 0, WAIT, WAIT_FOR_CLOSE };
35
36     rev_neigh_type rev_neigh;
37
38     communicator comm;
39     int ctrl_close_pending;
40     int data_close_pending;
41
42     unsigned iter;
43
44     double prev_load_broadcast;
45     double load;
46     double expected_load;
47
48     double sum_of_to_send() const;
49     virtual double load_balance(double my_load);
50
51     void compute();
52     void send1_no_bookkeeping(neighbor& nb);
53     void send1_bookkeeping(neighbor& nb);
54     void send();
55     bool receive(recv_wait_mode wait);
56     void finalize1(neighbor& nb);
57     void finalize();
58     void print_loads(e_xbt_log_priority_t logp = xbt_log_priority_info);
59 };
60
61 #endif // !PROCESS_H
62
63 // Local variables:
64 // mode: c++
65 // End: