diff --git a/include/ALL_ForceBased.hpp b/include/ALL_ForceBased.hpp index e417e24a0746ba578ff096fc00d10bde1c006c33..1b21aaea0bb1447feece819a8c2b4a2adfe127d1 100644 --- a/include/ALL_ForceBased.hpp +++ b/include/ALL_ForceBased.hpp @@ -121,22 +121,6 @@ public: /// @param [out] double providing the estimated LB after the balance step virtual W getEstimatedEfficiency() override {return (W)-1;} - /// method to get the current LB efficiency with the given work distribution - /// @return current LB efficiency - virtual W getEfficiency() override - { - W localSum = (W)0; - for (auto i = this->work.begin(); i < this->work.end(); ++i) - { - localSum += *i; - } - W globalMin; - W globalMax; - MPI_Allreduce(&localSum, &globalMin, 1, MPIDataTypeW, MPI_MIN, this->globalComm); - MPI_Allreduce(&localSum, &globalMax, 1, MPIDataTypeW, MPI_MAX, this->globalComm); - return (W)(1.0 - (globalMax - globalMin) / (globalMax + globalMin)); - } - private: // type for MPI communication MPI_Datatype MPIDataTypeT; diff --git a/include/ALL_Histogram.hpp b/include/ALL_Histogram.hpp index 139c131a34c6a56e4934926547bb763668325fa2..4b198b076dfae8e37cd2d1ce8b68949a5c06787a 100644 --- a/include/ALL_Histogram.hpp +++ b/include/ALL_Histogram.hpp @@ -114,22 +114,6 @@ public: /// @param [out] double providing the estimated LB after the balance step virtual W getEstimatedEfficiency() override; - /// method to get the current LB efficiency with the given work distribution - /// @return current LB efficiency - virtual W getEfficiency() override - { - W localSum = (W)0; - for (auto i = this->work.begin(); i < this->work.end(); ++i) - { - localSum += *i; - } - W globalMin; - W globalMax; - MPI_Allreduce(&localSum, &globalMin, 1, MPIDataTypeW, MPI_MIN, this->globalComm); - MPI_Allreduce(&localSum, &globalMax, 1, MPIDataTypeW, MPI_MAX, this->globalComm); - return (W)(1.0 - (globalMax - globalMin) / (globalMax + globalMin)); - } - private: /// number of bins in each dimension std::vector<int> nBins; diff --git a/include/ALL_LB.hpp b/include/ALL_LB.hpp index aab7ae49880aae6aa3fb74259666cdc6b2b1e983..35e220879649999ac9fdd0bf19d233b63fa66a8c 100644 --- a/include/ALL_LB.hpp +++ b/include/ALL_LB.hpp @@ -179,7 +179,21 @@ public: /// method to get the current LB efficiency with the given work distribution /// @return current LB efficiency - virtual W getEfficiency() = 0; + double getEfficiency() + { + double localSum = 0.0; + for (auto i = this->work.begin(); i < this->work.end(); ++i) + { + localSum += *i; + } + double globalMin; + double globalMax; + MPI_Allreduce(&localSum, &globalMin, 1, MPI_DOUBLE, MPI_MIN, this->globalComm); + MPI_Allreduce(&localSum, &globalMax, 1, MPI_DOUBLE, MPI_MAX, this->globalComm); + return (1.0 - (double)(globalMax - globalMin) / + (double)(globalMax + globalMin)); + } + /// method to provide a list of vertices describing the neighboring domains /// currently only implemented for VORONOI, as a means to get the anchor points diff --git a/include/ALL_Staggered.hpp b/include/ALL_Staggered.hpp index 1478b1c85a2fc16419c8d4544cf5be16bfeff2b1..290eeed00bf53e00d46ed41118249f63b8be9f54 100644 --- a/include/ALL_Staggered.hpp +++ b/include/ALL_Staggered.hpp @@ -96,23 +96,6 @@ public: /// @param [out] double providing the estimated LB after the balance step virtual W getEstimatedEfficiency() override {return (W)-1;}; - /// method to get the current LB efficiency with the given work distribution - /// @return current LB efficiency - virtual W getEfficiency() override - { - W localSum = (W)0; - for (auto i = this->work.begin(); i < this->work.end(); ++i) - { - localSum += *i; - } - W globalMin; - W globalMax; - MPI_Allreduce(&localSum, &globalMin, 1, MPIDataTypeW, MPI_MIN, this->globalComm); - MPI_Allreduce(&localSum, &globalMax, 1, MPIDataTypeW, MPI_MAX, this->globalComm); - return (W)(1.0 - (globalMax - globalMin) / (globalMax + globalMin)); - } - - private: /// data type for the communication of vertex-related data MPI_Datatype MPIDataTypeT; diff --git a/include/ALL_Tensor.hpp b/include/ALL_Tensor.hpp index 180fa8183ba055c5960c08caf8af21a4d5d8d32c..4d32277777ebbcf3dea500fbb4d62dc5e661f8fb 100644 --- a/include/ALL_Tensor.hpp +++ b/include/ALL_Tensor.hpp @@ -101,22 +101,6 @@ public: /// @param [out] double providing the estimated LB after the balance step virtual W getEstimatedEfficiency() override {return (W)-1;}; - /// method to get the current LB efficiency with the given work distribution - /// @return current LB efficiency - virtual W getEfficiency() override - { - W localSum = (W)0; - for (auto i = this->work.begin(); i < this->work.end(); ++i) - { - localSum += *i; - } - W globalMin; - W globalMax; - MPI_Allreduce(&localSum, &globalMin, 1, MPIDataTypeW, MPI_MIN, this->globalComm); - MPI_Allreduce(&localSum, &globalMax, 1, MPIDataTypeW, MPI_MAX, this->globalComm); - return (W)(1.0 - (globalMax - globalMin) / (globalMax + globalMin)); - } - private: // type for MPI communication MPI_Datatype MPIDataTypeT; diff --git a/include/ALL_Voronoi.hpp b/include/ALL_Voronoi.hpp index 82c2eb302a52cea7c6290778780e987430099c3e..cc7ff0d0022c4f9e7e5c257f5cca237bf98c6a9b 100644 --- a/include/ALL_Voronoi.hpp +++ b/include/ALL_Voronoi.hpp @@ -109,22 +109,6 @@ public: /// @param [out] double providing the estimated LB after the balance step virtual W getEstimatedEfficiency() override {return (W)-1;}; - /// method to get the current LB efficiency with the given work distribution - /// @return current LB efficiency - virtual W getEfficiency() override - { - W localSum = (W)0; - for (auto i = this->work.begin(); i < this->work.end(); ++i) - { - localSum += *i; - } - W globalMin; - W globalMax; - MPI_Allreduce(&localSum, &globalMin, 1, MPIDataTypeW, MPI_MIN, this->globalComm); - MPI_Allreduce(&localSum, &globalMax, 1, MPIDataTypeW, MPI_MAX, this->globalComm); - return (W)(1.0 - (globalMax - globalMin) / (globalMax + globalMin)); - } - private: // MPI values