X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/c771a55e40d2a41d607a0da1b67cd1f7d546ccc8..325b135f0ee33c6c0242a14e2f58a54fb571b032:/process.h diff --git a/process.h b/process.h index a49c6ef..c148683 100644 --- a/process.h +++ b/process.h @@ -1,8 +1,17 @@ #ifndef PROCESS_H #define PROCESS_H -#include +#define USE_UNORDERED_MAP 1 +//#undef USE_UNORDERED_MAP + #include +#ifdef USE_UNORDERED_MAP +# include +# define MAP_TEMPLATE std::tr1::unordered_map +#else +# include +# define MAP_TEMPLATE std::map +#endif #include #include "communicator.h" #include "neighbor.h" @@ -10,12 +19,20 @@ class process { public: process(int argc, char* argv[]); - ~process() { }; + ~process(); int run(); +protected: + typedef std::vector neigh_type; + typedef std::vector pneigh_type; + + neigh_type neigh; + pneigh_type pneigh; + private: - std::vector neigh; - std::map rev_neigh; + typedef MAP_TEMPLATE rev_neigh_type; + + rev_neigh_type rev_neigh; communicator comm; int ctrl_close_pending; @@ -26,8 +43,10 @@ private: double load; double expected_load; - void compute(); + double sum_of_to_send() const; virtual double load_balance(double my_load); + + void compute(); void send1_no_bookkeeping(neighbor& nb); void send1_bookkeeping(neighbor& nb); void send();