Deterministic BlockForest Creation
The following code runs under Windows but crashes under Linux. With removed mpi::MPIManager::instance()->resetMPI();
it is the other way round...
#include "blockforest/Initialization.h"
#include "core/DataTypes.h"
#include "core/debug/TestSubsystem.h"
#include "core/logging/Logging.h"
#include "core/mpi/Environment.h"
using namespace walberla;
void TwoBlockForestsTest()
{
math::AABB domainBlock(0,0,0,3,3,3);
Vector3<uint_t> cells (10,10,10);
Vector3<uint_t> blocks (2,2,2);
Vector3<uint_t> procs (2,2,2);
Vector3<bool> periodic(true, true, true);
uint_t peDomainFactor = uint_t(20);
AABB lbmDomainAABB( real_c(0), real_c(0), real_c(0), real_c(cells[0]), real_c(cells[1]), real_c(cells[2]) );
AABB peDomainAABB ( real_c(0), real_c(0), real_c(0), real_c(cells[0]), real_c(cells[1]), real_c(cells[2]*peDomainFactor) );
auto lbmBlocks = blockforest::createUniformBlockGrid(
lbmDomainAABB,
blocks[0], blocks[1], blocks[2], // number of blocks in x/y/z direction
cells[0]/blocks[0], cells[1]/blocks[1], cells[2]/blocks[2], // number of cells per block in x/y/z direction
procs[0], procs[1], procs[2], // number of processes in x/y/z direction
periodic[0], periodic[1], periodic[2], true ); // periodic in every direction
mpi::MPIManager::instance()->resetMPI();
auto peBlocks = blockforest::createUniformBlockGrid(
peDomainAABB,
blocks[0], blocks[1], blocks[2], // number of blocks in x/y/z direction
cells[0] / blocks[0], cells[1] / blocks[1], peDomainFactor * cells[2] / blocks[2], // number of cells per block in x/y/z direction
procs[0], procs[1], procs[2], // number of processes in x/y/z direction
periodic[0], periodic[1], periodic[2], true); // periodic in every direction
WALBERLA_CHECK_EQUAL( lbmBlocks->begin()->getId(), peBlocks->begin()->getId() );
}
int main( int argc, char** argv )
{
debug::enterTestMode();
mpi::Environment env( argc, argv );
MPIManager::instance()->useWorldComm();
TwoBlockForestsTest();
return EXIT_SUCCESS;
}
Edited by Sebastian Eibl