diff --git a/src/blockforest/loadbalancing/DynamicCurve.h b/src/blockforest/loadbalancing/DynamicCurve.h index d9767ecf055e8b1106bbcd2746381c5be4b89db1..d72b60726f0b1dab41e8e5708051b1bc7b238a22 100644 --- a/src/blockforest/loadbalancing/DynamicCurve.h +++ b/src/blockforest/loadbalancing/DynamicCurve.h @@ -792,8 +792,9 @@ void DynamicCurveBalance< PhantomData_T >::balanceWeighted( const std::vector< s long double weight( 0 ); int numBlocks( 0 ); while( c < blocks.size() && - std::abs( pWeight - weight - numeric_cast< long double >( allBlocks[ uint_c( blocks[c].first ) ][ blocks[c].second ].second ) ) <= - std::abs( pWeight - weight ) && + ( isIdentical(weight, 0.0l) || + std::abs( pWeight - weight - numeric_cast< long double >( allBlocks[ uint_c( blocks[c].first ) ][ blocks[c].second ].second ) ) <= + std::abs( pWeight - weight ) ) && numBlocks < maxBlocksPerProcess_ ) { targets[ uint_c( blocks[c].first ) ][ blocks[c].second ] = pid_c(p); diff --git a/src/blockforest/loadbalancing/StaticCurve.cpp b/src/blockforest/loadbalancing/StaticCurve.cpp index 9bb9c184dcc24b10cfd1bc93f388d59523911301..e90ec3bc10ac72a04ebbfe9ce6609552c4276158 100644 --- a/src/blockforest/loadbalancing/StaticCurve.cpp +++ b/src/blockforest/loadbalancing/StaticCurve.cpp @@ -123,9 +123,9 @@ uint_t StaticLevelwiseCurveBalanceWeighted::operator()( SetupBlockForest & fores { const workload_t pWeight = totalWeight / workload_c( numberOfProcesses - p ); workload_t weight( 0 ); - while( c < blocksOnLevel.size() && + while( c < blocksOnLevel.size() && ( isIdentical(weight, workload_t(0)) || std::abs( pWeight - weight - blocksOnLevel[c]->getWorkload() ) <= - std::abs( pWeight - weight ) ) + std::abs( pWeight - weight ) ) ) { blocksOnLevel[c]->assignTargetProcess(p); diff --git a/tests/pe/MinMaxRefinement.cpp b/tests/pe/MinMaxRefinement.cpp index 458052c0e4f1853e3ab03b8f45e91c040915699e..3c13d4cfbc7fc6aa974a9cb6f0688e98d813965c 100644 --- a/tests/pe/MinMaxRefinement.cpp +++ b/tests/pe/MinMaxRefinement.cpp @@ -144,7 +144,7 @@ int main( int argc, char ** argv ) ccd->reloadBodies(); } - WALBERLA_CHECK_EQUAL( blockforest.size(), mpi::MPIManager::instance()->worldRank() == 6 ? 1 : 0); + WALBERLA_CHECK_EQUAL( blockforest.size(), mpi::MPIManager::instance()->worldRank() == 0 ? 1 : 0); WALBERLA_LOG_DEVEL( infoCollection->size() ); for (unsigned int i = 0; i < 30; ++i)