diff --git a/tests/field/CMakeLists.txt b/tests/field/CMakeLists.txt index 47a1549e231c0265c4bd5f55602a5082ed63bf87..e22e9fe331e54008f42d328b799123c3ea5b3960 100644 --- a/tests/field/CMakeLists.txt +++ b/tests/field/CMakeLists.txt @@ -35,7 +35,8 @@ waLBerla_compile_test( FILES adaptors/AdaptorTest.cpp DEPENDS blockforest gui lb waLBerla_execute_test( NAME AdaptorTest ) waLBerla_compile_test( FILES FieldGatherTest.cpp DEPENDS blockforest gui ) -waLBerla_execute_test( NAME FieldGatherTest PROCESSES 3 ) +waLBerla_execute_test( NAME FieldGatherTest3 COMMAND $<TARGET_FILE:FieldGatherTest> PROCESSES 3 ) +waLBerla_execute_test( NAME FieldGatherTest1 COMMAND $<TARGET_FILE:FieldGatherTest> PROCESSES 1 ) waLBerla_compile_test( FILES FieldFileIOTest.cpp DEPENDS blockforest ) waLBerla_execute_test( NAME FieldFileIOTest1Proc COMMAND $<TARGET_FILE:FieldFileIOTest> PROCESSES 1 ) diff --git a/tests/field/FieldGatherTest.cpp b/tests/field/FieldGatherTest.cpp index 93743df323249a8c82d685e29c624265f56f8f9f..8f6645b03e8afd692029f51847e564cd6e32d228 100644 --- a/tests/field/FieldGatherTest.cpp +++ b/tests/field/FieldGatherTest.cpp @@ -36,10 +36,11 @@ int main( int argc, char ** argv ) debug::enterTestMode(); walberla::Environment walberlaEnv( argc, argv ); + bool oneBlockPerProcess = MPIManager::instance()->numProcesses() != 1; auto blocks = blockforest::createUniformBlockGrid( 1, 3, 1, // blocks in x,y,z 10u, 20u, 1u, // nr of cells per block 1.0, // dx - true // one block per process + oneBlockPerProcess ); typedef GhostLayerField<cell_idx_t,3> MyField; BlockDataID fieldID = field::addToStorage<MyField>( blocks, "Field" ); @@ -65,9 +66,10 @@ int main( int argc, char ** argv ) boundingBox.min()[ 1 ] = 10; boundingBox.max()[ 1 ] = 29; - field::gather<MyField>( gatheredField, blocks, fieldID, boundingBox,1 ); + auto targetRank = MPIManager::instance()->numProcesses() -1; + field::gather<MyField>( gatheredField, blocks, fieldID, boundingBox, targetRank ); - WALBERLA_EXCLUSIVE_WORLD_SECTION( 1 ) + WALBERLA_EXCLUSIVE_WORLD_SECTION( targetRank ) { for( auto cellIt = gatheredField.beginXYZ(); cellIt != gatheredField.end(); ++cellIt ) {