From: Arnaud Giersch Date: Fri, 18 Feb 2011 07:12:47 +0000 (+0100) Subject: Reintroduce process::get_sum_of_to_send(). X-Git-Tag: v0.1~126 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/9f84b4517edbbcab8263c968b34b562573edb5b6?ds=inline Reintroduce process::get_sum_of_to_send(). --- diff --git a/process.cpp b/process.cpp index 470ad41..8e9f524 100644 --- a/process.cpp +++ b/process.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -252,6 +253,17 @@ bool process::still_running() return last_status; } +double process::get_sum_of_to_send() const +{ + using std::tr1::bind; + using std::tr1::placeholders::_1; + using std::tr1::placeholders::_2; + + return std::accumulate(neigh.begin(), neigh.end(), 0.0, + bind(std::plus(), + _1, bind(&neighbor::get_to_send, _2))); +} + void process::load_balance() { if (lb_iter == 1) // warn only once diff --git a/process.h b/process.h index 3e912f0..926bf1f 100644 --- a/process.h +++ b/process.h @@ -110,6 +110,9 @@ private: bool still_running(); + // Returns the sum of "to_send" for all neighbors. + double get_sum_of_to_send() const; + // Send procedures void ctrl_send(neighbor& nb); void data_send(neighbor& nb);