From 9f84b4517edbbcab8263c968b34b562573edb5b6 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Fri, 18 Feb 2011 08:12:47 +0100 Subject: [PATCH] Reintroduce process::get_sum_of_to_send(). --- process.cpp | 12 ++++++++++++ process.h | 3 +++ 2 files changed, 15 insertions(+) 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); -- 2.39.5