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

Private GIT Repository
Wip++...
[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
35     rev_neigh_type rev_neigh;
36
37     communicator comm;
38     int ctrl_close_pending;
39     int data_close_pending;
40
41     unsigned iter;
42
43     double load;
44     double expected_load;
45
46     double sum_of_to_send() const;
47     virtual double load_balance(double my_load);
48
49     void compute();
50     void send1_no_bookkeeping(neighbor& nb);
51     void send1_bookkeeping(neighbor& nb);
52     void send();
53     bool receive(bool wait_for_close);
54     void finalize1(neighbor& nb);
55     void finalize();
56     void print_loads(e_xbt_log_priority_t logp = xbt_log_priority_info);
57
58     void insert_neighbor_in_map(neighbor& nb);
59 };
60
61 #endif // !PROCESS_H
62
63 // Local variables:
64 // mode: c++
65 // End: