diff --git a/src/core/cell/Cell.h b/src/core/cell/Cell.h index d52e763e898bd6d6fe97432a871e892d2e81001b..63a650dbd0dd11ef5a9ef6f03564131c8efe0e0a 100644 --- a/src/core/cell/Cell.h +++ b/src/core/cell/Cell.h @@ -160,7 +160,7 @@ inline bool Cell::operator==( const Cell & rhs ) const **********************************************************************************************************************/ inline cell_idx_t Cell::operator[]( std::size_t idx ) const { - WALBERLA_ASSERT_LESS( idx, 3, "Index 'idx' = " << idx << " out of bounds! Cell: " << *this ); + WALBERLA_ASSERT_LESS( idx, 3, "Index 'idx' = " << idx << " out of bounds! Cell: " << *this ) return cell[idx]; } @@ -259,7 +259,7 @@ inline Cell Cell::operator-() const **********************************************************************************************************************/ inline cell_idx_t & Cell::operator[]( std::size_t idx ) { - WALBERLA_ASSERT_LESS( idx, 3, "Index 'idx' = " << idx << " out of bounds! Cell: " << *this ); + WALBERLA_ASSERT_LESS( idx, 3, "Index 'idx' = " << idx << " out of bounds! Cell: " << *this ) return cell[idx]; } diff --git a/src/core/cell/CellInterval.h b/src/core/cell/CellInterval.h index 4befe87c1a85298e475636776bdd7eafd731e2b0..7b766fa3763bb890aca15b5f5c31e6891c54ee7d 100644 --- a/src/core/cell/CellInterval.h +++ b/src/core/cell/CellInterval.h @@ -146,11 +146,11 @@ public: const CellIntervalIterator & operator--() { decrement(); return *this; } CellIntervalIterator operator--(int) { CellIntervalIterator tmp = *this; decrement(); return tmp; } - bool operator==(const CellIntervalIterator & other) const { WALBERLA_ASSERT_EQUAL( &ci_, &other.ci_ ); return cell_ == other.cell_; } - bool operator!=(const CellIntervalIterator & other) const { WALBERLA_ASSERT_EQUAL( &ci_, &other.ci_ ); return cell_ != other.cell_; } + bool operator==(const CellIntervalIterator & other) const { WALBERLA_ASSERT_EQUAL( &ci_, &other.ci_ ) return cell_ == other.cell_; } + bool operator!=(const CellIntervalIterator & other) const { WALBERLA_ASSERT_EQUAL( &ci_, &other.ci_ ) return cell_ != other.cell_; } - Cell operator*() const { WALBERLA_ASSERT( ci_.contains(cell_) ); return cell_; } - const Cell * operator->() const { WALBERLA_ASSERT( ci_.contains(cell_) ); return &cell_; } + Cell operator*() const { WALBERLA_ASSERT( ci_.contains(cell_) ) return cell_; } + const Cell * operator->() const { WALBERLA_ASSERT( ci_.contains(cell_) ) return &cell_; } private: inline void increment(); @@ -259,9 +259,9 @@ inline CellInterval& CellInterval::shift( const cell_idx_t x, const cell_idx_t y inline CellInterval& CellInterval::shift( const uint_t x, const uint_t y, const uint_t z ) { - WALBERLA_ASSERT_GREATER_EQUAL( cell_idx_c(x), 0 ); - WALBERLA_ASSERT_GREATER_EQUAL( cell_idx_c(y), 0 ); - WALBERLA_ASSERT_GREATER_EQUAL( cell_idx_c(z), 0 ); + WALBERLA_ASSERT_GREATER_EQUAL( cell_idx_c(x), 0 ) + WALBERLA_ASSERT_GREATER_EQUAL( cell_idx_c(y), 0 ) + WALBERLA_ASSERT_GREATER_EQUAL( cell_idx_c(z), 0 ) min_.x() += cell_idx_c(x); min_.y() += cell_idx_c(y); diff --git a/src/core/cell/CellSet.cpp b/src/core/cell/CellSet.cpp index b39e20a779f778e14c16c5b884fb2f9fbae44179..1b711301945abc4b861740c9ba3627c24a1a46c6 100644 --- a/src/core/cell/CellSet.cpp +++ b/src/core/cell/CellSet.cpp @@ -31,7 +31,7 @@ namespace cell { /// Complexity is O(N), where N == this->size() CellInterval CellSet::boundingBox() const { - WALBERLA_ASSERT( !empty() ); + WALBERLA_ASSERT( !empty() ) Set<Cell>::const_iterator beginIt = Set<Cell>::begin(); Set<Cell>::const_iterator endIt = Set<Cell>::end(); diff --git a/src/lbm/field/initializer/ExprSystemInitFunction.cpp b/src/lbm/field/initializer/ExprSystemInitFunction.cpp index bb3f5ebcd44d6adfaca910d1a67f9c930b43c149..455b5ec7722e7ec45335f470f88793d7bd788ea6 100644 --- a/src/lbm/field/initializer/ExprSystemInitFunction.cpp +++ b/src/lbm/field/initializer/ExprSystemInitFunction.cpp @@ -99,7 +99,7 @@ bool ExprSystemInitFunction::parse( const Config::BlockHandle & config ) { WALBERLA_LOG_WARNING( "Error in expression for u_x\n" << "Error : " << parser.error() << "\n" << - "Expression: " << ux_expr_str ); + "Expression: " << ux_expr_str ) valid = false; } @@ -109,7 +109,7 @@ bool ExprSystemInitFunction::parse( const Config::BlockHandle & config ) { WALBERLA_LOG_WARNING( "Error in expression for u_y\n" << "Error : " << parser.error() << "\n" << - "Expression: " << uy_expr_str ); + "Expression: " << uy_expr_str ) valid = false; } @@ -119,7 +119,7 @@ bool ExprSystemInitFunction::parse( const Config::BlockHandle & config ) { WALBERLA_LOG_WARNING( "Error in expression for u_z\n" << "Error : " << parser.error() << "\n" << - "Expression: " << uz_expr_str ); + "Expression: " << uz_expr_str ) valid = false; } @@ -129,7 +129,7 @@ bool ExprSystemInitFunction::parse( const Config::BlockHandle & config ) { WALBERLA_LOG_WARNING( "Error in expression for rho\n" << "Error : " << parser.error() << "\n" << - "Expression: " << rho_expr_str ); + "Expression: " << rho_expr_str ) valid = false; } diff --git a/src/lbm/field/initializer/PdfFieldInitializer.h b/src/lbm/field/initializer/PdfFieldInitializer.h index 5a718f8d77af614d9397967c9f159a3814f4587c..7b22110089e7bfc3e64c0c1d6d464faf9ae3502d 100644 --- a/src/lbm/field/initializer/PdfFieldInitializer.h +++ b/src/lbm/field/initializer/PdfFieldInitializer.h @@ -32,6 +32,9 @@ namespace walberla { namespace lbm { namespace initializer { +template< bool UseCellCenter > +auto getCoordinates(const Cell& globalCell, const real_t dx); + template< typename LatticeModel_T > class PdfFieldInitializer diff --git a/src/lbm/field/initializer/PdfFieldInitializer.impl.h b/src/lbm/field/initializer/PdfFieldInitializer.impl.h index a883915b5ad368fcbbde61093e6ba28e38176149..757cb180e1e8725b954b75c19a049fbd4139cc86 100644 --- a/src/lbm/field/initializer/PdfFieldInitializer.impl.h +++ b/src/lbm/field/initializer/PdfFieldInitializer.impl.h @@ -24,6 +24,27 @@ namespace walberla { namespace lbm { namespace initializer { +template<> +auto getCoordinates<false>(const Cell& globalCell, const real_t dx) { + + Cell coords; + for(uint_t d = 0; d < 3; ++d) { + coords[d] = cell_idx_c( real_c(globalCell[d]) * dx ); + } + return coords; + +} + +template<> +auto getCoordinates<true>(const Cell& globalCell, const real_t dx) { + + Vector3<real_t> coords; + for(uint_t d = 0; d < 3; ++d) { + coords[d] = (real_c(globalCell[d]) + 0.5_r) * dx ; + } + return coords; + +} template< typename LatticeModel_T > PdfFieldInitializer< LatticeModel_T >::PdfFieldInitializer( const BlockDataID & pdfFieldId, const shared_ptr<StructuredBlockForest> & blocks ) @@ -34,18 +55,25 @@ template< typename LatticeModel_T > template< typename InitFunc > void PdfFieldInitializer< LatticeModel_T >::initDensity( InitFunc & func ) const { + constexpr bool UseCellCenter = std::is_invocable_r_v<real_t, InitFunc, Vector3<real_t> const&>; + static_assert( UseCellCenter || std::is_invocable_r_v<real_t, InitFunc, Cell const&> ); + for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { auto pdfField = blockIt->template getData<PdfField_T>( pdfFieldId_ ); - WALBERLA_ASSERT_NOT_NULLPTR( pdfField ); + WALBERLA_ASSERT_NOT_NULLPTR( pdfField ) + + const auto level = blocks_->getLevel(*blockIt); + const auto dx = blocks_->dx(level); for( auto cellIt = pdfField->beginWithGhostLayerXYZ(); cellIt != pdfField->end(); ++cellIt ) { Cell globalCell( cellIt.cell() ); blocks_->transformBlockLocalToGlobalCell( globalCell, *blockIt ); + auto coords = getCoordinates<UseCellCenter>( globalCell, dx ); const Vector3<real_t> velocity = pdfField->getVelocity( cellIt.cell() ); - pdfField->setDensityAndVelocity( cellIt.cell(), velocity, func( globalCell ) ); + pdfField->setDensityAndVelocity( cellIt.cell(), velocity, func(coords) ); } } } @@ -55,18 +83,25 @@ template< typename LatticeModel_T > template< typename InitFunc > void PdfFieldInitializer< LatticeModel_T >::initVelocity( InitFunc & func ) const { + constexpr bool UseCellCenter = std::is_invocable_r_v<Vector3<real_t>, InitFunc, Vector3<real_t> const&>; + static_assert( UseCellCenter || std::is_invocable_r_v<Vector3<real_t>, InitFunc, Cell const&> ); + for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { auto pdfField = blockIt->template getData<PdfField_T>( pdfFieldId_ ); - WALBERLA_ASSERT_NOT_NULLPTR( pdfField ); + WALBERLA_ASSERT_NOT_NULLPTR( pdfField ) + + const auto level = blocks_->getLevel(*blockIt); + const auto dx = blocks_->dx(level); for( auto cellIt = pdfField->beginWithGhostLayerXYZ(); cellIt != pdfField->end(); ++cellIt ) { Cell globalCell( cellIt.cell() ); blocks_->transformBlockLocalToGlobalCell( globalCell, *blockIt ); - + auto coords = getCoordinates<UseCellCenter>( globalCell, dx ); + const real_t density = pdfField->getDensity( cellIt.cell() ); - pdfField->setDensityAndVelocity( cellIt.cell(), func( globalCell ), density ); + pdfField->setDensityAndVelocity( cellIt.cell(), func( coords ), density ); } } } @@ -76,18 +111,25 @@ template< typename LatticeModel_T > template< typename InitFunc > void PdfFieldInitializer< LatticeModel_T >::initDensityAndVelocity( InitFunc & func ) const { + constexpr bool UseCellCenter = std::is_invocable_r_v<std::vector<real_t>, InitFunc, Vector3<real_t> const&>; + static_assert( std::is_invocable_r_v<std::vector<real_t>, InitFunc, Cell const&> || UseCellCenter ); + for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { auto pdfField = blockIt->template getData<PdfField_T>( pdfFieldId_ ); - WALBERLA_ASSERT_NOT_NULLPTR( pdfField ); + WALBERLA_ASSERT_NOT_NULLPTR( pdfField ) + + const auto level = blocks_->getLevel(*blockIt); + const auto dx = blocks_->dx(level); for( auto cellIt = pdfField->beginWithGhostLayerXYZ(); cellIt != pdfField->end(); ++cellIt ) { Cell globalCell( cellIt.cell() ); blocks_->transformBlockLocalToGlobalCell( globalCell, *blockIt ); - - const std::vector<real_t> densityAndVelocity = func( globalCell ); - WALBERLA_ASSERT_EQUAL( densityAndVelocity.size(), 4 ); + auto coords = getCoordinates<UseCellCenter>( globalCell, dx ); + + const std::vector<real_t> densityAndVelocity = func( coords ); + WALBERLA_ASSERT_EQUAL( densityAndVelocity.size(), 4 ) const real_t density( densityAndVelocity[0] ); const Vector3<real_t> velocity( densityAndVelocity[1], densityAndVelocity[2], densityAndVelocity[3] ); diff --git a/tests/blockforest/BlockDataIOTest.cpp b/tests/blockforest/BlockDataIOTest.cpp index 7f1507bc1ca508cca10dd070d5feb7f549d5ffe9..90c4360966c4ac7c31595d6eca1f079e066a8360 100644 --- a/tests/blockforest/BlockDataIOTest.cpp +++ b/tests/blockforest/BlockDataIOTest.cpp @@ -77,7 +77,7 @@ void test() uint_t(14)); blockforest::BlockForestEvaluation evaluation(sbf->getBlockForest()); - WALBERLA_LOG_INFO_ON_ROOT("BlockForest:\n" << evaluation.toString()); + WALBERLA_LOG_INFO_ON_ROOT("BlockForest:\n" << evaluation.toString()) // auto originalFieldId = field::addToStorage< FieldType >( sbf, "OriginalField", 0.0, field::zyxf, uint_t(3), false, // None, Empty ); @@ -107,7 +107,7 @@ void test() auto readIt = readField->begin(); for (auto origIt = originalField->begin(); origIt != originalField->end(); ++origIt, ++readIt) - WALBERLA_CHECK_IDENTICAL(*origIt, *readIt); + WALBERLA_CHECK_IDENTICAL(*origIt, *readIt) } } diff --git a/tests/blockforest/BlockForestTest.cpp b/tests/blockforest/BlockForestTest.cpp index e032b7de66420ca0e17c4fa6206c5e29889452b4..6c18b2fa0d5f8130b5bb45789fa29675e579070b 100644 --- a/tests/blockforest/BlockForestTest.cpp +++ b/tests/blockforest/BlockForestTest.cpp @@ -261,19 +261,19 @@ static void test() { for( uint_t i = 0; i != size; ++i ) { const real_t recv = byteArrayToReal< real_t >( buffer, i * ( sizeof(real_t) + 3 ) ); - WALBERLA_CHECK( realIsIdentical( recv, send[i] ) ); + WALBERLA_CHECK( realIsIdentical( recv, send[i] ) ) } } - WALBERLA_MPI_WORLD_BARRIER(); + WALBERLA_MPI_WORLD_BARRIER() BlockForest bforest( uint_c( MPIManager::instance()->rank() ), sforest, true ); BlockForest fforest_1( uint_c( MPIManager::instance()->rank() ), "blockforest.sav", false, true ); // all processes read the same file - WALBERLA_CHECK_EQUAL( bforest, fforest_1 ); + WALBERLA_CHECK_EQUAL( bforest, fforest_1 ) BlockForest fforest_2( uint_c( MPIManager::instance()->rank() ), "blockforest.sav", true, true ); // only the root process reads the file - WALBERLA_CHECK_EQUAL( bforest, fforest_2 ); + WALBERLA_CHECK_EQUAL( bforest, fforest_2 ) SUID level1( "Level_1" ); SUID level2( "Level_2" ); @@ -295,154 +295,154 @@ static void test() { if( block->getLevel() == 0 ) { - WALBERLA_CHECK( block->getState().empty() ); + WALBERLA_CHECK( block->getState().empty() ) - WALBERLA_CHECK_NULLPTR( block->getData< uint_t >( data1 ) ); - WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data2 ) ); - WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data2 )), uint_c(5) ); + WALBERLA_CHECK_NULLPTR( block->getData< uint_t >( data1 ) ) + WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data2 ) ) + WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data2 )), uint_c(5) ) - WALBERLA_CHECK( !block->isBlockDataAllocated( data1 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data2 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ); + WALBERLA_CHECK( !block->isBlockDataAllocated( data1 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data2 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ) - WALBERLA_CHECK( block->isDataOfType<uint_t>( data2 ) ); - WALBERLA_CHECK( !block->isDataOfType<int>( data2 ) ); - WALBERLA_CHECK( block->isDataClassOrSubclassOf<uint_t>( data2 ) ); - WALBERLA_CHECK( !block->isDataClassOrSubclassOf<BlockDataID>( data2 ) ); + WALBERLA_CHECK( block->isDataOfType<uint_t>( data2 ) ) + WALBERLA_CHECK( !block->isDataOfType<int>( data2 ) ) + WALBERLA_CHECK( block->isDataClassOrSubclassOf<uint_t>( data2 ) ) + WALBERLA_CHECK( !block->isDataClassOrSubclassOf<BlockDataID>( data2 ) ) } else if( block->getLevel() == 1 ) { - WALBERLA_CHECK_EQUAL( block->getState().size(), uint_c(1) ); + WALBERLA_CHECK_EQUAL( block->getState().size(), uint_c(1) ) - WALBERLA_CHECK_NULLPTR( block->getData< uint_t >( data1 ) ); - WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data2 ) ); - WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data2 )), uint_c(5) ); + WALBERLA_CHECK_NULLPTR( block->getData< uint_t >( data1 ) ) + WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data2 ) ) + WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data2 )), uint_c(5) ) - WALBERLA_CHECK( !block->isBlockDataAllocated( data1 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data2 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ); + WALBERLA_CHECK( !block->isBlockDataAllocated( data1 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data2 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ) - WALBERLA_CHECK( block->isDataOfType<uint_t>( data2 ) ); - WALBERLA_CHECK( !block->isDataOfType<SUID>( data2 ) ); - WALBERLA_CHECK( block->isDataClassOrSubclassOf<uint_t>( data2 ) ); - WALBERLA_CHECK( !block->isDataClassOrSubclassOf<double>( data2 ) ); + WALBERLA_CHECK( block->isDataOfType<uint_t>( data2 ) ) + WALBERLA_CHECK( !block->isDataOfType<SUID>( data2 ) ) + WALBERLA_CHECK( block->isDataClassOrSubclassOf<uint_t>( data2 ) ) + WALBERLA_CHECK( !block->isDataClassOrSubclassOf<double>( data2 ) ) } else if( block->getLevel() == 2 ) { - WALBERLA_CHECK_EQUAL( block->getState().size(), uint_c(1) ); + WALBERLA_CHECK_EQUAL( block->getState().size(), uint_c(1) ) - WALBERLA_CHECK_NULLPTR( block->getData< uint_t >( data1 ) ); - WALBERLA_CHECK_NULLPTR( block->getData< uint_t >( data2 ) ); + WALBERLA_CHECK_NULLPTR( block->getData< uint_t >( data1 ) ) + WALBERLA_CHECK_NULLPTR( block->getData< uint_t >( data2 ) ) - WALBERLA_CHECK( !block->isBlockDataAllocated( data1 ) ); - WALBERLA_CHECK( !block->isBlockDataAllocated( data2 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ); + WALBERLA_CHECK( !block->isBlockDataAllocated( data1 ) ) + WALBERLA_CHECK( !block->isBlockDataAllocated( data2 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ) } else if( block->getLevel() == 3 ) { - WALBERLA_CHECK_EQUAL( block->getState().size(), uint_c(1) ); + WALBERLA_CHECK_EQUAL( block->getState().size(), uint_c(1) ) - WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data1 ) ); - WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data1 )), uint_c(23) ); - WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data2 ) ); - WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data2 )), uint_c( 5) ); + WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data1 ) ) + WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data1 )), uint_c(23) ) + WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data2 ) ) + WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data2 )), uint_c( 5) ) - WALBERLA_CHECK( block->isBlockDataAllocated( data1 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data2 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ); + WALBERLA_CHECK( block->isBlockDataAllocated( data1 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data2 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ) - WALBERLA_CHECK( block->isDataOfSameType( data1, data2 ) ); + WALBERLA_CHECK( block->isDataOfSameType( data1, data2 ) ) } else if( block->getLevel() == 4 ) { - WALBERLA_CHECK_EQUAL( block->getState().size(), uint_c(1) ); + WALBERLA_CHECK_EQUAL( block->getState().size(), uint_c(1) ) - WALBERLA_CHECK_NOT_NULLPTR( block->getData< int >( data1 ) ); - WALBERLA_CHECK_EQUAL( *(block->getData< int >( data1 )), uint_c(42) ); - WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data2 ) ); - WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data2 )), uint_c( 5) ); + WALBERLA_CHECK_NOT_NULLPTR( block->getData< int >( data1 ) ) + WALBERLA_CHECK_EQUAL( *(block->getData< int >( data1 )), uint_c(42) ) + WALBERLA_CHECK_NOT_NULLPTR( block->getData< uint_t >( data2 ) ) + WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( data2 )), uint_c( 5) ) - WALBERLA_CHECK( block->isBlockDataAllocated( data1 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data2 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ); - WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ); + WALBERLA_CHECK( block->isBlockDataAllocated( data1 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data2 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data3 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data4 ) ) + WALBERLA_CHECK( block->isBlockDataAllocated( data5 ) ) - WALBERLA_CHECK( !block->isDataOfSameType( data1, data2 ) ); + WALBERLA_CHECK( !block->isDataOfSameType( data1, data2 ) ) const Base* base = block->getData< Base >( data3 ); - WALBERLA_CHECK_EQUAL( base->override(), 1 ); - WALBERLA_CHECK_EQUAL( base->func(), 2 ); + WALBERLA_CHECK_EQUAL( base->override(), 1 ) + WALBERLA_CHECK_EQUAL( base->func(), 2 ) - WALBERLA_CHECK( block->isDataOfType<Base>( data3 ) ); - WALBERLA_CHECK( !block->isDataOfType<Derived>( data3 ) ); + WALBERLA_CHECK( block->isDataOfType<Base>( data3 ) ) + WALBERLA_CHECK( !block->isDataOfType<Derived>( data3 ) ) - WALBERLA_CHECK( block->isDataClassOrSubclassOf<Base>( data3 ) ); - WALBERLA_CHECK( !block->isDataClassOrSubclassOf<Derived>( data3 ) ); - WALBERLA_CHECK( !block->isDataClassOrSubclassOf<int>( data3 ) ); + WALBERLA_CHECK( block->isDataClassOrSubclassOf<Base>( data3 ) ) + WALBERLA_CHECK( !block->isDataClassOrSubclassOf<Derived>( data3 ) ) + WALBERLA_CHECK( !block->isDataClassOrSubclassOf<int>( data3 ) ) - WALBERLA_CHECK( !block->isDataSubclassOf<Base>( data3 ) ); - WALBERLA_CHECK( !block->isDataSubclassOf<Derived>( data3 ) ); - WALBERLA_CHECK( !block->isDataSubclassOf<int>( data3 ) ); + WALBERLA_CHECK( !block->isDataSubclassOf<Base>( data3 ) ) + WALBERLA_CHECK( !block->isDataSubclassOf<Derived>( data3 ) ) + WALBERLA_CHECK( !block->isDataSubclassOf<int>( data3 ) ) base = block->getData< Base >( data4 ); const Derived* derived = block->getData< Derived >( data4 ); - WALBERLA_CHECK_EQUAL( base->override(), 1 ); - WALBERLA_CHECK_EQUAL( base->func(), 20 ); + WALBERLA_CHECK_EQUAL( base->override(), 1 ) + WALBERLA_CHECK_EQUAL( base->func(), 20 ) - WALBERLA_CHECK_EQUAL( derived->override(), 10 ); - WALBERLA_CHECK_EQUAL( derived->func(), 20 ); + WALBERLA_CHECK_EQUAL( derived->override(), 10 ) + WALBERLA_CHECK_EQUAL( derived->func(), 20 ) - WALBERLA_CHECK( !block->isDataOfType<Base>( data4 ) ); - WALBERLA_CHECK( block->isDataOfType<Derived>( data4 ) ); + WALBERLA_CHECK( !block->isDataOfType<Base>( data4 ) ) + WALBERLA_CHECK( block->isDataOfType<Derived>( data4 ) ) - WALBERLA_CHECK( block->isDataClassOrSubclassOf<Base>( data4 ) ); - WALBERLA_CHECK( block->isDataClassOrSubclassOf<Derived>( data4 ) ); - WALBERLA_CHECK( !block->isDataClassOrSubclassOf<int>( data4 ) ); + WALBERLA_CHECK( block->isDataClassOrSubclassOf<Base>( data4 ) ) + WALBERLA_CHECK( block->isDataClassOrSubclassOf<Derived>( data4 ) ) + WALBERLA_CHECK( !block->isDataClassOrSubclassOf<int>( data4 ) ) - WALBERLA_CHECK( block->isDataSubclassOf<Base>( data4 ) ); - WALBERLA_CHECK( !block->isDataSubclassOf<Derived>( data4 ) ); - WALBERLA_CHECK( !block->isDataSubclassOf<int>( data4 ) ); + WALBERLA_CHECK( block->isDataSubclassOf<Base>( data4 ) ) + WALBERLA_CHECK( !block->isDataSubclassOf<Derived>( data4 ) ) + WALBERLA_CHECK( !block->isDataSubclassOf<int>( data4 ) ) base = block->getData< Base >( data5 ); const SecondBase* sBase = block->getData< SecondBase >( data5 ); const Multi* multi = block->getData< Multi >( data5 ); - WALBERLA_CHECK( reinterpret_cast< const void* >( base ) != reinterpret_cast< const void* >( sBase ) ) ; + WALBERLA_CHECK( reinterpret_cast< const void* >( base ) != reinterpret_cast< const void* >( sBase ) ) WALBERLA_CHECK( ( reinterpret_cast< const void* >( base ) != reinterpret_cast< const void* >( multi ) ) || - ( reinterpret_cast< const void* >( sBase ) != reinterpret_cast< const void* >( multi ) ) ); + ( reinterpret_cast< const void* >( sBase ) != reinterpret_cast< const void* >( multi ) ) ) - WALBERLA_CHECK_EQUAL( base->override(), 1 ); - WALBERLA_CHECK_EQUAL( base->func(), 2000 ); + WALBERLA_CHECK_EQUAL( base->override(), 1 ) + WALBERLA_CHECK_EQUAL( base->func(), 2000 ) - WALBERLA_CHECK_EQUAL( sBase->override(), 100 ); + WALBERLA_CHECK_EQUAL( sBase->override(), 100 ) - WALBERLA_CHECK_EQUAL( multi->override(), 1000 ); - WALBERLA_CHECK_EQUAL( multi->func(), 2000 ); + WALBERLA_CHECK_EQUAL( multi->override(), 1000 ) + WALBERLA_CHECK_EQUAL( multi->func(), 2000 ) - WALBERLA_CHECK( !block->isDataOfType<Base>( data5 ) ); - WALBERLA_CHECK( !block->isDataOfType<SecondBase>( data5 ) ); - WALBERLA_CHECK( block->isDataOfType<Multi>( data5 ) ); + WALBERLA_CHECK( !block->isDataOfType<Base>( data5 ) ) + WALBERLA_CHECK( !block->isDataOfType<SecondBase>( data5 ) ) + WALBERLA_CHECK( block->isDataOfType<Multi>( data5 ) ) - WALBERLA_CHECK( block->isDataClassOrSubclassOf<Base>( data5 ) ); - WALBERLA_CHECK( block->isDataClassOrSubclassOf<SecondBase>( data5 ) ); - WALBERLA_CHECK( block->isDataClassOrSubclassOf<Multi>( data5 ) ); - WALBERLA_CHECK( !block->isDataClassOrSubclassOf<Derived>( data5 ) ); + WALBERLA_CHECK( block->isDataClassOrSubclassOf<Base>( data5 ) ) + WALBERLA_CHECK( block->isDataClassOrSubclassOf<SecondBase>( data5 ) ) + WALBERLA_CHECK( block->isDataClassOrSubclassOf<Multi>( data5 ) ) + WALBERLA_CHECK( !block->isDataClassOrSubclassOf<Derived>( data5 ) ) - WALBERLA_CHECK( block->isDataSubclassOf<Base>( data5 ) ); - WALBERLA_CHECK( block->isDataSubclassOf<SecondBase>( data5 ) ); - WALBERLA_CHECK( !block->isDataSubclassOf<Multi>( data5 ) ); - WALBERLA_CHECK( !block->isDataSubclassOf<Derived>( data5 ) ); + WALBERLA_CHECK( block->isDataSubclassOf<Base>( data5 ) ) + WALBERLA_CHECK( block->isDataSubclassOf<SecondBase>( data5 ) ) + WALBERLA_CHECK( !block->isDataSubclassOf<Multi>( data5 ) ) + WALBERLA_CHECK( !block->isDataSubclassOf<Derived>( data5 ) ) } } @@ -453,17 +453,17 @@ static void test() { std::set< BlockID > forestBlockSet; for( auto block = sforest.begin(); block != sforest.end(); ++block ) { - WALBERLA_CHECK_EQUAL( setupBlockSet.find( block->getId() ), setupBlockSet.end() ); + WALBERLA_CHECK_EQUAL( setupBlockSet.find( block->getId() ), setupBlockSet.end() ) setupBlockSet.insert( block->getId() ); } for( auto blockId = blockIds.begin(); blockId != blockIds.end(); ++blockId ) { const BlockID id = *dynamic_cast< BlockID* >( blockId->get() ); - WALBERLA_CHECK_EQUAL( forestBlockSet.find( id ), forestBlockSet.end() ); + WALBERLA_CHECK_EQUAL( forestBlockSet.find( id ), forestBlockSet.end() ) forestBlockSet.insert( id ); } - WALBERLA_CHECK_EQUAL( setupBlockSet, forestBlockSet ); + WALBERLA_CHECK_EQUAL( setupBlockSet, forestBlockSet ) } diff --git a/tests/blockforest/BlockIDTest.cpp b/tests/blockforest/BlockIDTest.cpp index 45e8fdbf0794c0a66bbb74a48188eb0a9f56cc96..2cdbfe38f226840a7154856215ec91f8b7827f54 100644 --- a/tests/blockforest/BlockIDTest.cpp +++ b/tests/blockforest/BlockIDTest.cpp @@ -26,7 +26,6 @@ #include "core/mpi/SendBuffer.h" #include <cstdlib> -#include <cstring> #include <map> #include <vector> @@ -69,26 +68,26 @@ static void test() { walberla::mpi::GenericSendBuffer<uint8_t> sb; oldId.toBuffer( sb ); - WALBERLA_CHECK_EQUAL( (oldId.getUsedBytes() + oldId.getUsedBytes() * mpi::BUFFER_DEBUG_OVERHEAD) + (1 + mpi::BUFFER_DEBUG_OVERHEAD ), sb.size() ); + WALBERLA_CHECK_EQUAL( (oldId.getUsedBytes() + oldId.getUsedBytes() * mpi::BUFFER_DEBUG_OVERHEAD) + (1 + mpi::BUFFER_DEBUG_OVERHEAD ), sb.size() ) for( uint_t b = branches; b-- != 0; ) { - WALBERLA_CHECK_EQUAL( id.getBranchId(), branch[b] ); + WALBERLA_CHECK_EQUAL( id.getBranchId(), branch[b] ) id.removeBranchId(); } - WALBERLA_CHECK_EQUAL( id.getTreeIndex(), treeIndex ); + WALBERLA_CHECK_EQUAL( id.getTreeIndex(), treeIndex ) BlockID newId( byteArray, 0, byteArray.size() ); - WALBERLA_CHECK_EQUAL( oldId, newId ); + WALBERLA_CHECK_EQUAL( oldId, newId ) for( uint_t b = branches; b-- != 0; ) { - WALBERLA_CHECK_EQUAL( newId.getBranchId(), branch[b] ); + WALBERLA_CHECK_EQUAL( newId.getBranchId(), branch[b] ) newId.removeBranchId(); } - WALBERLA_CHECK_EQUAL( newId.getTreeIndex(), treeIndex ); + WALBERLA_CHECK_EQUAL( newId.getTreeIndex(), treeIndex ) walberla::mpi::GenericRecvBuffer<uint8_t> rb( sb ); newId.fromBuffer( rb ); - WALBERLA_CHECK_EQUAL( oldId, newId ); + WALBERLA_CHECK_EQUAL( oldId, newId ) } std::vector< BlockID > blockId; @@ -115,7 +114,7 @@ static void test() { } } for( uint_t j = 0; j != blockId.size(); ++j ) - WALBERLA_CHECK_EQUAL( value[j], idMap[blockId[j]] ); + WALBERLA_CHECK_EQUAL( value[j], idMap[blockId[j]] ) bit <<= 1; mask <<= 1; diff --git a/tests/blockforest/DeterministicCreation.cpp b/tests/blockforest/DeterministicCreation.cpp index d43582255c6899d8ec15d585d8de7bcce198908e..9841fb5d248c213c29340217c9483bb94f0221c0 100644 --- a/tests/blockforest/DeterministicCreation.cpp +++ b/tests/blockforest/DeterministicCreation.cpp @@ -28,8 +28,6 @@ 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); @@ -58,10 +56,10 @@ void TwoBlockForestsTest() 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_LOG_DEVEL(lbmBlocks->begin()->getAABB()); - WALBERLA_LOG_DEVEL(peBlocks->begin()->getAABB()); + WALBERLA_LOG_DEVEL(lbmBlocks->begin()->getAABB()) + WALBERLA_LOG_DEVEL(peBlocks->begin()->getAABB()) - WALBERLA_CHECK_EQUAL( lbmBlocks->begin()->getId(), peBlocks->begin()->getId() ); + WALBERLA_CHECK_EQUAL( lbmBlocks->begin()->getId(), peBlocks->begin()->getId() ) } int main( int argc, char** argv ) diff --git a/tests/blockforest/SaveLoadTest.cpp b/tests/blockforest/SaveLoadTest.cpp index 12e41b44ac3c495f13ac90d6a7ec95ec925226ab..a96e7ab367a5b9023318aae900c8bd11d28cc422 100644 --- a/tests/blockforest/SaveLoadTest.cpp +++ b/tests/blockforest/SaveLoadTest.cpp @@ -36,7 +36,7 @@ void blockForestSaveLoadTest(const BlockForest::FileIOMode ioMode, const bool br std::vector< walberla::uint64_t > dump; std::vector< walberla::uint64_t > check; - WALBERLA_LOG_DEVEL_ON_ROOT("*** DUMPING ***"); + WALBERLA_LOG_DEVEL_ON_ROOT("*** DUMPING ***") dump.clear(); @@ -50,13 +50,13 @@ void blockForestSaveLoadTest(const BlockForest::FileIOMode ioMode, const bool br for (auto blockIt = forestDump->begin(); blockIt != forestDump->end(); ++blockIt) { - WALBERLA_LOG_DEVEL("DUMPING BLOCK (" << blockIt->getId() << ") " << blockIt->getAABB() ); + WALBERLA_LOG_DEVEL("DUMPING BLOCK (" << blockIt->getId() << ") " << blockIt->getAABB() ) dump.push_back( blockIt->getId().getID() ); } - WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER();} + WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER()} - WALBERLA_LOG_DEVEL_ON_ROOT("*** CHECKING ***"); + WALBERLA_LOG_DEVEL_ON_ROOT("*** CHECKING ***") check.clear(); @@ -64,22 +64,22 @@ void blockForestSaveLoadTest(const BlockForest::FileIOMode ioMode, const bool br for (auto blockIt = forestCheck->begin(); blockIt != forestCheck->end(); ++blockIt) { - WALBERLA_LOG_DEVEL("CHECKING BLOCK (" << blockIt->getId() << ") " << blockIt->getAABB() ); + WALBERLA_LOG_DEVEL("CHECKING BLOCK (" << blockIt->getId() << ") " << blockIt->getAABB() ) check.push_back( blockIt->getId().getID() ); } - WALBERLA_CHECK_EQUAL(forestDump->getBlockIdBytes(), forestCheck->getBlockIdBytes()); - WALBERLA_CHECK_EQUAL(forestDump->getDepth(), forestCheck->getDepth()); - WALBERLA_CHECK_EQUAL(forestDump->getDomain(), forestCheck->getDomain()); - WALBERLA_CHECK_EQUAL(forestDump->getNumberOfBlocks(), forestCheck->getNumberOfBlocks()); + WALBERLA_CHECK_EQUAL(forestDump->getBlockIdBytes(), forestCheck->getBlockIdBytes()) + WALBERLA_CHECK_EQUAL(forestDump->getDepth(), forestCheck->getDepth()) + WALBERLA_CHECK_EQUAL(forestDump->getDomain(), forestCheck->getDomain()) + WALBERLA_CHECK_EQUAL(forestDump->getNumberOfBlocks(), forestCheck->getNumberOfBlocks()) std::sort(dump.begin(), dump.end()); std::sort(check.begin(), check.end()); - WALBERLA_CHECK_EQUAL( dump.size(), check.size() ); + WALBERLA_CHECK_EQUAL( dump.size(), check.size() ) for (size_t i = 0; i < dump.size(); ++i) { - WALBERLA_CHECK_EQUAL(dump[i], check[i]); + WALBERLA_CHECK_EQUAL(dump[i], check[i]) } } @@ -95,27 +95,27 @@ int main( int argc, char ** argv ) blockForestSaveLoadTest(BlockForest::MPI_PARALLEL, true); - WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER();} + WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER()} WALBERLA_MPI_SECTION() {walberla::MPIManager::instance()->resetMPI();} blockForestSaveLoadTest(BlockForest::MASTER_SLAVE, true); - WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER();} + WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER()} WALBERLA_MPI_SECTION() {walberla::MPIManager::instance()->resetMPI();} blockForestSaveLoadTest(BlockForest::SERIALIZED_DISTRIBUTED, true); - WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER();} + WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER()} WALBERLA_MPI_SECTION() {walberla::MPIManager::instance()->resetMPI();} blockForestSaveLoadTest(BlockForest::MPI_PARALLEL, false); - WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER();} + WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER()} WALBERLA_MPI_SECTION() {walberla::MPIManager::instance()->resetMPI();} blockForestSaveLoadTest(BlockForest::MASTER_SLAVE, false); - WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER();} + WALBERLA_MPI_SECTION() {WALBERLA_MPI_BARRIER()} WALBERLA_MPI_SECTION() {walberla::MPIManager::instance()->resetMPI();} blockForestSaveLoadTest(BlockForest::SERIALIZED_DISTRIBUTED, false); diff --git a/tests/blockforest/SetupBlockForestTest.cpp b/tests/blockforest/SetupBlockForestTest.cpp index 46d6d2cb2c40b66072f4d21bdc5d4ff0cacbf3af..527a41776b4f14dc341a36988aad0f21c19dfffc 100644 --- a/tests/blockforest/SetupBlockForestTest.cpp +++ b/tests/blockforest/SetupBlockForestTest.cpp @@ -52,7 +52,7 @@ static void refinementSelectionFunctionRandom( SetupBlockForest& forest ) { #ifndef WALBERLA_BLOCKFOREST_PRIMITIVE_BLOCKID const uint_t maxLevel = 25; #else - WALBERLA_ASSERT_GREATER_EQUAL( math::UINT_BITS, 32 ); + WALBERLA_ASSERT_GREATER_EQUAL( math::UINT_BITS, 32 ) const uint_t maxLevel = ( math::UINT_BITS - 14 ) / 3; #endif @@ -78,47 +78,47 @@ static void checkCollectorConsistency( SetupBlockForest& forest ) { for( SetupBlockForest::iterator it = forest.begin(); it != forest.end(); ++it ) itBlocks.push_back( it.get() ); - WALBERLA_CHECK_EQUAL( blocks.size(), itBlocks.size() ); + WALBERLA_CHECK_EQUAL( blocks.size(), itBlocks.size() ) for( uint_t i = 0; i != blocks.size(); ++i ) - WALBERLA_CHECK( blocks[i] == itBlocks[i] ); + WALBERLA_CHECK( blocks[i] == itBlocks[i] ) std::set< SetupBlock* > baseSet; for( uint_t i = 0; i != blocks.size(); ++i ) baseSet.insert( blocks[i] ); - WALBERLA_CHECK_EQUAL( baseSet.size(), blocks.size() ); + WALBERLA_CHECK_EQUAL( baseSet.size(), blocks.size() ) std::vector< SetupBlock* > hilbertBlocks; forest.getHilbertOrder( hilbertBlocks ); - WALBERLA_CHECK_EQUAL( hilbertBlocks.size(), blocks.size() ); + WALBERLA_CHECK_EQUAL( hilbertBlocks.size(), blocks.size() ) std::set< SetupBlock* > hilbertSet; for( uint_t i = 0; i != hilbertBlocks.size(); ++i ) hilbertSet.insert( hilbertBlocks[i] ); - WALBERLA_CHECK_EQUAL( hilbertSet.size(), hilbertBlocks.size() ); + WALBERLA_CHECK_EQUAL( hilbertSet.size(), hilbertBlocks.size() ) std::set< SetupBlock* >::iterator baseIterator = baseSet.begin(); std::set< SetupBlock* >::iterator hilbertIterator = hilbertSet.begin(); while( baseIterator != baseSet.end() ) { - WALBERLA_CHECK( *baseIterator == *hilbertIterator ); + WALBERLA_CHECK( *baseIterator == *hilbertIterator ) ++baseIterator; ++hilbertIterator; } std::vector< SetupBlock* > aabbBlocks; forest.getBlocksOverlappedByAABB( aabbBlocks, forest.getDomain() ); - WALBERLA_CHECK_EQUAL( aabbBlocks.size(), blocks.size() ); + WALBERLA_CHECK_EQUAL( aabbBlocks.size(), blocks.size() ) std::set< SetupBlock* > aabbSet; for( uint_t i = 0; i != aabbBlocks.size(); ++i ) aabbSet.insert( aabbBlocks[i] ); - WALBERLA_CHECK_EQUAL( aabbSet.size(), aabbBlocks.size() ); + WALBERLA_CHECK_EQUAL( aabbSet.size(), aabbBlocks.size() ) baseIterator = baseSet.begin(); std::set< SetupBlock* >::iterator aabbIterator = aabbSet.begin(); while( baseIterator != baseSet.end() ) { - WALBERLA_CHECK( *baseIterator == *aabbIterator ); + WALBERLA_CHECK( *baseIterator == *aabbIterator ) ++baseIterator; ++aabbIterator; } @@ -147,7 +147,7 @@ static void checkNeighborhoodConsistency( const SetupBlockForest& forest ) { constructNeighborhoodSectionBlockCenters( n, block->getAABB(), neighborhoodSectionBlockCenters ); - WALBERLA_CHECK_EQUAL( neighborhoodSectionBlockCenters.size() % 3, uint_c(0) ); + WALBERLA_CHECK_EQUAL( neighborhoodSectionBlockCenters.size() % 3, uint_c(0) ) for( uint_t p = 0; p != neighborhoodSectionBlockCenters.size(); p += 3 ) { @@ -173,12 +173,12 @@ static void checkNeighborhoodConsistency( const SetupBlockForest& forest ) { // either one neighbor must be hit OR the block is located at the border of the (non-periodic) simulation domain if( noHit ) - WALBERLA_CHECK( forest.getBlock(x,y,z) == nullptr ); + WALBERLA_CHECK( forest.getBlock(x,y,z) == nullptr ) } // every neighbor must be hit by at least one point for( uint_t c = 0; c != block->getNeighborhoodSectionSize(n); ++c ) - WALBERLA_CHECK( hit[c] ); + WALBERLA_CHECK( hit[c] ) neighborhoodSectionBlockCenters.clear(); } diff --git a/tests/blockforest/StructuredBlockForestTest.cpp b/tests/blockforest/StructuredBlockForestTest.cpp index fc9ce847cd0c55800623d99128fd6585109fea03..8b0bf5b940c93fcfa8c3249e47a66b8c4cf441e6 100644 --- a/tests/blockforest/StructuredBlockForestTest.cpp +++ b/tests/blockforest/StructuredBlockForestTest.cpp @@ -124,237 +124,237 @@ static void test() { // block data for( auto block = forest.begin(); block != forest.end(); ++block ) { - WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( bdid23 )), 23 ); - WALBERLA_CHECK_EQUAL( *(block->getData< int >( bdid42 )), 42 ); - WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( bdidZ )), 70 ); - WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( bdidY )), 60 ); + WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( bdid23 )), 23 ) + WALBERLA_CHECK_EQUAL( *(block->getData< int >( bdid42 )), 42 ) + WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( bdidZ )), 70 ) + WALBERLA_CHECK_EQUAL( *(block->getData< uint_t >( bdidY )), 60 ) } // getDomainCellBB CellInterval bb = forest.getDomainCellBB(); - WALBERLA_CHECK_EQUAL( bb.xMin(), 0 ); - WALBERLA_CHECK_EQUAL( bb.yMin(), 0 ); - WALBERLA_CHECK_EQUAL( bb.zMin(), 0 ); - WALBERLA_CHECK_EQUAL( bb.xMax(), 99 ); - WALBERLA_CHECK_EQUAL( bb.yMax(), 119 ); - WALBERLA_CHECK_EQUAL( bb.zMax(), 139 ); + WALBERLA_CHECK_EQUAL( bb.xMin(), 0 ) + WALBERLA_CHECK_EQUAL( bb.yMin(), 0 ) + WALBERLA_CHECK_EQUAL( bb.zMin(), 0 ) + WALBERLA_CHECK_EQUAL( bb.xMax(), 99 ) + WALBERLA_CHECK_EQUAL( bb.yMax(), 119 ) + WALBERLA_CHECK_EQUAL( bb.zMax(), 139 ) bb = forest.getDomainCellBB(1); - WALBERLA_CHECK_EQUAL( bb.xMin(), 0 ); - WALBERLA_CHECK_EQUAL( bb.yMin(), 0 ); - WALBERLA_CHECK_EQUAL( bb.zMin(), 0 ); - WALBERLA_CHECK_EQUAL( bb.xMax(), 199 ); - WALBERLA_CHECK_EQUAL( bb.yMax(), 239 ); - WALBERLA_CHECK_EQUAL( bb.zMax(), 279 ); + WALBERLA_CHECK_EQUAL( bb.xMin(), 0 ) + WALBERLA_CHECK_EQUAL( bb.yMin(), 0 ) + WALBERLA_CHECK_EQUAL( bb.zMin(), 0 ) + WALBERLA_CHECK_EQUAL( bb.xMax(), 199 ) + WALBERLA_CHECK_EQUAL( bb.yMax(), 239 ) + WALBERLA_CHECK_EQUAL( bb.zMax(), 279 ) // getNumberOf*Cells - WALBERLA_CHECK_EQUAL( forest.getNumberOfXCells(), 100 ); - WALBERLA_CHECK_EQUAL( forest.getNumberOfYCells(), 120 ); - WALBERLA_CHECK_EQUAL( forest.getNumberOfZCells(), 140 ); + WALBERLA_CHECK_EQUAL( forest.getNumberOfXCells(), 100 ) + WALBERLA_CHECK_EQUAL( forest.getNumberOfYCells(), 120 ) + WALBERLA_CHECK_EQUAL( forest.getNumberOfZCells(), 140 ) - WALBERLA_CHECK_EQUAL( forest.getNumberOfXCells(1), 200 ); - WALBERLA_CHECK_EQUAL( forest.getNumberOfYCells(1), 240 ); - WALBERLA_CHECK_EQUAL( forest.getNumberOfZCells(1), 280 ); + WALBERLA_CHECK_EQUAL( forest.getNumberOfXCells(1), 200 ) + WALBERLA_CHECK_EQUAL( forest.getNumberOfYCells(1), 240 ) + WALBERLA_CHECK_EQUAL( forest.getNumberOfZCells(1), 280 ) - WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(0), 100 ); - WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(1), 120 ); - WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(2), 140 ); + WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(0), 100 ) + WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(1), 120 ) + WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(2), 140 ) - WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(0,1), 200 ); - WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(1,1), 240 ); - WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(2,1), 280 ); + WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(0,1), 200 ) + WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(1,1), 240 ) + WALBERLA_CHECK_EQUAL( forest.getNumberOfCells(2,1), 280 ) // dx/dy/dz - WALBERLA_CHECK_FLOAT_EQUAL( forest.dx(), 100.0 / 100.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( forest.dy(), 100.0 / 120.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( forest.dz(), 100.0 / 140.0 ); + WALBERLA_CHECK_FLOAT_EQUAL( forest.dx(), 100.0 / 100.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( forest.dy(), 100.0 / 120.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( forest.dz(), 100.0 / 140.0 ) - WALBERLA_CHECK_FLOAT_EQUAL( forest.dx(1), 100.0 / 200.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( forest.dy(1), 100.0 / 240.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( forest.dz(1), 100.0 / 280.0 ); + WALBERLA_CHECK_FLOAT_EQUAL( forest.dx(1), 100.0 / 200.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( forest.dy(1), 100.0 / 240.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( forest.dz(1), 100.0 / 280.0 ) // mapToPeriodicDomain Cell cell( cell_idx_c(42), cell_idx_c(234), cell_idx_c(567) ); forest.mapToPeriodicDomain( cell ); - WALBERLA_CHECK_EQUAL( cell.x(), 42 ); - WALBERLA_CHECK_EQUAL( cell.y(), 234 ); - WALBERLA_CHECK_EQUAL( cell.z(), 567 ); + WALBERLA_CHECK_EQUAL( cell.x(), 42 ) + WALBERLA_CHECK_EQUAL( cell.y(), 234 ) + WALBERLA_CHECK_EQUAL( cell.z(), 567 ) cell.x() = cell_idx_c(-123); forest.mapToPeriodicDomain( cell ); - WALBERLA_CHECK_EQUAL( cell.x(), 77 ); - WALBERLA_CHECK_EQUAL( cell.y(), 234 ); - WALBERLA_CHECK_EQUAL( cell.z(), 567 ); + WALBERLA_CHECK_EQUAL( cell.x(), 77 ) + WALBERLA_CHECK_EQUAL( cell.y(), 234 ) + WALBERLA_CHECK_EQUAL( cell.z(), 567 ) cell.x() = cell_idx_c(-223); forest.mapToPeriodicDomain( cell, 1 ); - WALBERLA_CHECK_EQUAL( cell.x(), 177 ); - WALBERLA_CHECK_EQUAL( cell.y(), 234 ); - WALBERLA_CHECK_EQUAL( cell.z(), 567 ); + WALBERLA_CHECK_EQUAL( cell.x(), 177 ) + WALBERLA_CHECK_EQUAL( cell.y(), 234 ) + WALBERLA_CHECK_EQUAL( cell.z(), 567 ) cell.x() = cell_idx_c(123); forest.mapToPeriodicDomain( cell ); - WALBERLA_CHECK_EQUAL( cell.x(), 23 ); - WALBERLA_CHECK_EQUAL( cell.y(), 234 ); - WALBERLA_CHECK_EQUAL( cell.z(), 567 ); + WALBERLA_CHECK_EQUAL( cell.x(), 23 ) + WALBERLA_CHECK_EQUAL( cell.y(), 234 ) + WALBERLA_CHECK_EQUAL( cell.z(), 567 ) cell.x() = cell_idx_c(123); forest.mapToPeriodicDomain( cell, 1 ); - WALBERLA_CHECK_EQUAL( cell.x(), 123 ); - WALBERLA_CHECK_EQUAL( cell.y(), 234 ); - WALBERLA_CHECK_EQUAL( cell.z(), 567 ); + WALBERLA_CHECK_EQUAL( cell.x(), 123 ) + WALBERLA_CHECK_EQUAL( cell.y(), 234 ) + WALBERLA_CHECK_EQUAL( cell.z(), 567 ) cell.x() = cell_idx_c(223); forest.mapToPeriodicDomain( cell, 1 ); - WALBERLA_CHECK_EQUAL( cell.x(), 23 ); - WALBERLA_CHECK_EQUAL( cell.y(), 234 ); - WALBERLA_CHECK_EQUAL( cell.z(), 567 ); + WALBERLA_CHECK_EQUAL( cell.x(), 23 ) + WALBERLA_CHECK_EQUAL( cell.y(), 234 ) + WALBERLA_CHECK_EQUAL( cell.z(), 567 ) // getCell forest.getCell( cell, real_c(23.5), real_c(49.9), real_c(50.1) ); - WALBERLA_CHECK_EQUAL( cell.x(), 23 ); - WALBERLA_CHECK_EQUAL( cell.y(), 59 ); - WALBERLA_CHECK_EQUAL( cell.z(), 70 ); + WALBERLA_CHECK_EQUAL( cell.x(), 23 ) + WALBERLA_CHECK_EQUAL( cell.y(), 59 ) + WALBERLA_CHECK_EQUAL( cell.z(), 70 ) forest.getCell( cell, real_c(-23.5), real_c(49.9), real_c(50.1) ); - WALBERLA_CHECK_EQUAL( cell.x(), -24 ); - WALBERLA_CHECK_EQUAL( cell.y(), 59 ); - WALBERLA_CHECK_EQUAL( cell.z(), 70 ); + WALBERLA_CHECK_EQUAL( cell.x(), -24 ) + WALBERLA_CHECK_EQUAL( cell.y(), 59 ) + WALBERLA_CHECK_EQUAL( cell.z(), 70 ) forest.getCell( cell, real_c(123.5), real_c(49.9), real_c(50.1) ); - WALBERLA_CHECK_EQUAL( cell.x(), 123 ); - WALBERLA_CHECK_EQUAL( cell.y(), 59 ); - WALBERLA_CHECK_EQUAL( cell.z(), 70 ); + WALBERLA_CHECK_EQUAL( cell.x(), 123 ) + WALBERLA_CHECK_EQUAL( cell.y(), 59 ) + WALBERLA_CHECK_EQUAL( cell.z(), 70 ) forest.getCell( cell, real_c(23.4), real_c(49.9), real_c(50.1), 1 ); - WALBERLA_CHECK_EQUAL( cell.x(), 46 ); - WALBERLA_CHECK_EQUAL( cell.y(), 119 ); - WALBERLA_CHECK_EQUAL( cell.z(), 140 ); + WALBERLA_CHECK_EQUAL( cell.x(), 46 ) + WALBERLA_CHECK_EQUAL( cell.y(), 119 ) + WALBERLA_CHECK_EQUAL( cell.z(), 140 ) forest.getCell( cell, real_c(-23.4), real_c(49.9), real_c(50.1), 1 ); - WALBERLA_CHECK_EQUAL( cell.x(), -47 ); - WALBERLA_CHECK_EQUAL( cell.y(), 119 ); - WALBERLA_CHECK_EQUAL( cell.z(), 140 ); + WALBERLA_CHECK_EQUAL( cell.x(), -47 ) + WALBERLA_CHECK_EQUAL( cell.y(), 119 ) + WALBERLA_CHECK_EQUAL( cell.z(), 140 ) forest.getCell( cell, real_c(123.4), real_c(49.9), real_c(50.1), 1 ); - WALBERLA_CHECK_EQUAL( cell.x(), 246 ); - WALBERLA_CHECK_EQUAL( cell.y(), 119 ); - WALBERLA_CHECK_EQUAL( cell.z(), 140 ); + WALBERLA_CHECK_EQUAL( cell.x(), 246 ) + WALBERLA_CHECK_EQUAL( cell.y(), 119 ) + WALBERLA_CHECK_EQUAL( cell.z(), 140 ) forest.getCell( cell, real_c(-1.1), real_c(0), real_c(0) ); - WALBERLA_CHECK_EQUAL( cell.x(), -2 ); + WALBERLA_CHECK_EQUAL( cell.x(), -2 ) forest.getCell( cell, real_c(-1.0), real_c(0), real_c(0) ); - WALBERLA_CHECK_EQUAL( cell.x(), -1 ); + WALBERLA_CHECK_EQUAL( cell.x(), -1 ) forest.getCell( cell, real_c(-0.5), real_c(0), real_c(0) ); - WALBERLA_CHECK_EQUAL( cell.x(), -1 ); + WALBERLA_CHECK_EQUAL( cell.x(), -1 ) forest.getCell( cell, real_c(-0.0), real_c(0), real_c(0) ); - WALBERLA_CHECK_EQUAL( cell.x(), 0 ); + WALBERLA_CHECK_EQUAL( cell.x(), 0 ) forest.getCell( cell, real_c(0.0), real_c(0), real_c(0) ); - WALBERLA_CHECK_EQUAL( cell.x(), 0 ); + WALBERLA_CHECK_EQUAL( cell.x(), 0 ) forest.getCell( cell, real_c(0.5), real_c(0), real_c(0) ); - WALBERLA_CHECK_EQUAL( cell.x(), 0 ); + WALBERLA_CHECK_EQUAL( cell.x(), 0 ) forest.getCell( cell, real_c(1.0), real_c(0), real_c(0) ); - WALBERLA_CHECK_EQUAL( cell.x(), 1 ); + WALBERLA_CHECK_EQUAL( cell.x(), 1 ) forest.getCell( cell, real_c(1.1), real_c(0), real_c(0) ); - WALBERLA_CHECK_EQUAL( cell.x(), 1 ); + WALBERLA_CHECK_EQUAL( cell.x(), 1 ) // getCellCenter - real_t x,y,z; + real_t x, y, z; forest.getCellCenter( x, y, z, Cell(23,59,70) ); - WALBERLA_CHECK_FLOAT_EQUAL( x, 23.5 ); - WALBERLA_CHECK_FLOAT_EQUAL( y, ( 59 + 0.5 ) * 100.0 / 120.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( z, ( 70 + 0.5 ) * 100.0 / 140.0 ); + WALBERLA_CHECK_FLOAT_EQUAL( x, 23.5 ) + WALBERLA_CHECK_FLOAT_EQUAL( y, ( 59 + 0.5 ) * 100.0 / 120.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( z, ( 70 + 0.5 ) * 100.0 / 140.0 ) forest.getCellCenter( x, y, z, Cell(-24,49,72) ); - WALBERLA_CHECK_FLOAT_EQUAL( x, -23.5 ); - WALBERLA_CHECK_FLOAT_EQUAL( y, ( 49 + 0.5 ) * 100.0 / 120.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( z, ( 72 + 0.5 ) * 100.0 / 140.0 ); + WALBERLA_CHECK_FLOAT_EQUAL( x, -23.5 ) + WALBERLA_CHECK_FLOAT_EQUAL( y, ( 49 + 0.5 ) * 100.0 / 120.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( z, ( 72 + 0.5 ) * 100.0 / 140.0 ) forest.getCellCenter( x, y, z, Cell(123,47,62) ); - WALBERLA_CHECK_FLOAT_EQUAL( x, 123.5 ); - WALBERLA_CHECK_FLOAT_EQUAL( y, ( 47 + 0.5 ) * 100.0 / 120.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( z, ( 62 + 0.5 ) * 100.0 / 140.0 ); + WALBERLA_CHECK_FLOAT_EQUAL( x, 123.5 ) + WALBERLA_CHECK_FLOAT_EQUAL( y, ( 47 + 0.5 ) * 100.0 / 120.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( z, ( 62 + 0.5 ) * 100.0 / 140.0 ) forest.getCellCenter( x, y, z, Cell(46,119,140), 1 ); - WALBERLA_CHECK_FLOAT_EQUAL( x, 23.25 ); - WALBERLA_CHECK_FLOAT_EQUAL( y, ( 119 + 0.5 ) * 100.0 / 240.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( z, ( 140 + 0.5 ) * 100.0 / 280.0 ); + WALBERLA_CHECK_FLOAT_EQUAL( x, 23.25 ) + WALBERLA_CHECK_FLOAT_EQUAL( y, ( 119 + 0.5 ) * 100.0 / 240.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( z, ( 140 + 0.5 ) * 100.0 / 280.0 ) forest.getCellCenter( x, y, z, Cell(-47,109,142), 1 ); - WALBERLA_CHECK_FLOAT_EQUAL( x, -23.25 ); - WALBERLA_CHECK_FLOAT_EQUAL( y, ( 109 + 0.5 ) * 100.0 / 240.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( z, ( 142 + 0.5 ) * 100.0 / 280.0 ); + WALBERLA_CHECK_FLOAT_EQUAL( x, -23.25 ) + WALBERLA_CHECK_FLOAT_EQUAL( y, ( 109 + 0.5 ) * 100.0 / 240.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( z, ( 142 + 0.5 ) * 100.0 / 280.0 ) forest.getCellCenter( x, y, z, Cell(246,19,1400), 1 ); - WALBERLA_CHECK_FLOAT_EQUAL( x, 123.25 ); - WALBERLA_CHECK_FLOAT_EQUAL( y, ( 19 + 0.5 ) * 100.0 / 240.0 ); - WALBERLA_CHECK_FLOAT_EQUAL( z, ( 1400 + 0.5 ) * 100.0 / 280.0 ); + WALBERLA_CHECK_FLOAT_EQUAL( x, 123.25 ) + WALBERLA_CHECK_FLOAT_EQUAL( y, ( 19 + 0.5 ) * 100.0 / 240.0 ) + WALBERLA_CHECK_FLOAT_EQUAL( z, ( 1400 + 0.5 ) * 100.0 / 280.0 ) // getCellBBFromAABB & getCellBBFromCellAlignedAABB forest.getCellBBFromAABB( bb, AABB(real_c(2.0),real_c(0.0),real_c(0.0),real_c(23.0),real_c(25.0),real_c(50.0)) ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(2,0,0),Cell(22,29,69)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(2,0,0),Cell(22,29,69)) ) forest.getCellBBFromCellAlignedAABB( bb, AABB(real_c(2.0),real_c(0.0),real_c(0.0),real_c(23.0),real_c(25.0),real_c(50.0)) ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(2,0,0),Cell(22,29,69)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(2,0,0),Cell(22,29,69)) ) - WALBERLA_CHECK( forest.isCellAlignedAABB( AABB(real_c(2.0),real_c(0.0),real_c(0.0),real_c(23.0),real_c(25.0),real_c(50.0)) ) ); + WALBERLA_CHECK( forest.isCellAlignedAABB( AABB(real_c(2.0),real_c(0.0),real_c(0.0),real_c(23.0),real_c(25.0),real_c(50.0)) ) ) forest.getCellBBFromAABB( bb, AABB(real_c(2.3),real_c(0.12),real_c(0.42),real_c(23.1),real_c(25.1),real_c(50.1)) ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(2,0,0),Cell(23,30,70)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(2,0,0),Cell(23,30,70)) ) - WALBERLA_CHECK( !forest.isCellAlignedAABB( AABB(real_c(2.3),real_c(0.12),real_c(0.42),real_c(23.1),real_c(25.1),real_c(50.1)) ) ); + WALBERLA_CHECK( !forest.isCellAlignedAABB( AABB(real_c(2.3),real_c(0.12),real_c(0.42),real_c(23.1),real_c(25.1),real_c(50.1)) ) ) forest.getCellBBFromAABB( bb, AABB(real_c(2.5),real_c(0.0),real_c(0.0),real_c(23.5),real_c(25.0),real_c(50.0)), 1 ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(5,0,0),Cell(46,59,139)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(5,0,0),Cell(46,59,139)) ) forest.getCellBBFromCellAlignedAABB( bb, AABB(real_c(2.5),real_c(0.0),real_c(0.0),real_c(23.5),real_c(25.0),real_c(50.0)), 1 ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(5,0,0),Cell(46,59,139)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(5,0,0),Cell(46,59,139)) ) - WALBERLA_CHECK( forest.isCellAlignedAABB( AABB(real_c(2.5),real_c(0.0),real_c(0.0),real_c(23.5),real_c(25.0),real_c(50.0)), 1 ) ); - WALBERLA_CHECK( !forest.isCellAlignedAABB( AABB(real_c(2.5),real_c(0.0),real_c(0.0),real_c(23.5),real_c(25.0),real_c(50.0)) ) ); + WALBERLA_CHECK( forest.isCellAlignedAABB( AABB(real_c(2.5),real_c(0.0),real_c(0.0),real_c(23.5),real_c(25.0),real_c(50.0)), 1 ) ) + WALBERLA_CHECK( !forest.isCellAlignedAABB( AABB(real_c(2.5),real_c(0.0),real_c(0.0),real_c(23.5),real_c(25.0),real_c(50.0)) ) ) forest.getCellBBFromAABB( bb, AABB(real_c(2.7),real_c(0.12),real_c(0.22),real_c(23.6),real_c(25.1),real_c(50.1)), 1 ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(5,0,0),Cell(47,60,140)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(5,0,0),Cell(47,60,140)) ) - WALBERLA_CHECK( !forest.isCellAlignedAABB( AABB(real_c(2.7),real_c(0.12),real_c(0.22),real_c(23.6),real_c(25.1),real_c(50.1)), 1 ) ); + WALBERLA_CHECK( !forest.isCellAlignedAABB( AABB(real_c(2.7),real_c(0.12),real_c(0.22),real_c(23.6),real_c(25.1),real_c(50.1)), 1 ) ) // getAABBFromCellBB @@ -362,61 +362,61 @@ static void test() { forest.getAABBFromCellBB( aabb, CellInterval(Cell(3,0,0),Cell(46,29,139)) ); - WALBERLA_CHECK_EQUAL( aabb, AABB(real_c(3),real_c(0),real_c(0),real_c(47),real_c(25),real_c(100)) ); + WALBERLA_CHECK_EQUAL( aabb, AABB(real_c(3),real_c(0),real_c(0),real_c(47),real_c(25),real_c(100)) ) forest.getAABBFromCellBB( aabb, CellInterval(Cell(3,0,0),Cell(46,59,279)), 1 ); - WALBERLA_CHECK_EQUAL( aabb, AABB(real_c(1.5),real_c(0),real_c(0),real_c(23.5),real_c(25),real_c(100)) ); + WALBERLA_CHECK_EQUAL( aabb, AABB(real_c(1.5),real_c(0),real_c(0),real_c(23.5),real_c(25),real_c(100)) ) // getBlock & getBlockCellBB const IBlock* block = forest.getBlock( Cell(-1,23,42) ); - WALBERLA_CHECK_NULLPTR( block ); + WALBERLA_CHECK_NULLPTR( block ) block = forest.getBlock( Cell(1,23,42) ); - WALBERLA_CHECK_NULLPTR( block ); + WALBERLA_CHECK_NULLPTR( block ) block = forest.getBlock( Cell(50,23,42) ); - WALBERLA_CHECK_NOT_NULLPTR( block ); + WALBERLA_CHECK_NOT_NULLPTR( block ) bb = forest.getBlockCellBB( *block ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(50,0,0),Cell(99,59,69)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(50,0,0),Cell(99,59,69)) ) block = forest.getBlock( Cell(49,63,42) ); - WALBERLA_CHECK_NOT_NULLPTR( block ); + WALBERLA_CHECK_NOT_NULLPTR( block ) bb = forest.getBlockCellBB( *block ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(0,60,0),Cell(49,119,69)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(0,60,0),Cell(49,119,69)) ) block = forest.getBlock( Cell(52,63,42) ); - WALBERLA_CHECK_NOT_NULLPTR( block ); + WALBERLA_CHECK_NOT_NULLPTR( block ) bb = forest.getBlockCellBB( *block ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(50,60,0),Cell(99,119,69)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(50,60,0),Cell(99,119,69)) ) block = forest.getBlock( Cell(1,23,72) ); - WALBERLA_CHECK_NOT_NULLPTR( block ); + WALBERLA_CHECK_NOT_NULLPTR( block ) bb = forest.getBlockCellBB( *block ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(0,0,70),Cell(49,59,139)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(0,0,70),Cell(49,59,139)) ) block = forest.getBlock( Cell(51,63,72) ); - WALBERLA_CHECK_NULLPTR( block ); + WALBERLA_CHECK_NULLPTR( block ) ConstBlockDataID bid = forest.getBlockCellBBId(); block = forest.getBlock( Cell(23,42,240), 1 ); - WALBERLA_CHECK_NULLPTR( block ); + WALBERLA_CHECK_NULLPTR( block ) forest.getCellCenter( x, y, z, Cell(23,42,240), 1 ); block = forest.getBlock( x, y, z ); - WALBERLA_CHECK_NOT_NULLPTR( block ); + WALBERLA_CHECK_NOT_NULLPTR( block ) block = forest.getBlock( Cell(100,179,200), 1 ); - WALBERLA_CHECK_NOT_NULLPTR( block ); + WALBERLA_CHECK_NOT_NULLPTR( block ) bb = *( block->getData< CellInterval >( bid ) ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(100,120,140),Cell(149,179,209)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(100,120,140),Cell(149,179,209)) ) block = forest.getBlock( Cell(155,230,279), 1 ); - WALBERLA_CHECK_NOT_NULLPTR( block ); + WALBERLA_CHECK_NOT_NULLPTR( block ) bb = *( block->getData< CellInterval >( bid ) ); - WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(150,180,210),Cell(199,239,279)) ); + WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(150,180,210),Cell(199,239,279)) ) std::mt19937 eng( 23 ); for( int i = 0; i < 23; ++i ) @@ -432,7 +432,7 @@ static void test() { localPoint1 = globalPoint; forest.transformGlobalToBlockLocal( localPoint1, *blockIt ); - WALBERLA_CHECK_EQUAL( localPoint0, localPoint1 ); + WALBERLA_CHECK_EQUAL( localPoint0, localPoint1 ) Vector3<real_t> globalPoint0, globalPoint1; @@ -441,12 +441,12 @@ static void test() { globalPoint1 = localPoint0; forest.transformBlockLocalToGlobal( globalPoint1, *blockIt ); - WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[0], globalPoint0[0] ); - WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[1], globalPoint0[1] ); - WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[2], globalPoint0[2] ); - WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[0], globalPoint1[0] ); - WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[1], globalPoint1[1] ); - WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[2], globalPoint1[2] ); + WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[0], globalPoint0[0] ) + WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[1], globalPoint0[1] ) + WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[2], globalPoint0[2] ) + WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[0], globalPoint1[0] ) + WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[1], globalPoint1[1] ) + WALBERLA_CHECK_FLOAT_EQUAL( globalPoint[2], globalPoint1[2] ) } } } diff --git a/tests/blockforest/communication/DirectionBasedReduceCommTest.cpp b/tests/blockforest/communication/DirectionBasedReduceCommTest.cpp index 1a130a2d6baada5789a16bc09de3c2745929f8be..9382547824e4b3b307033a7e7e9fb1607e08a773 100644 --- a/tests/blockforest/communication/DirectionBasedReduceCommTest.cpp +++ b/tests/blockforest/communication/DirectionBasedReduceCommTest.cpp @@ -52,8 +52,8 @@ class SumSweep { ScalarField * valField = block->getData<ScalarField>(valFieldID_); ScalarField * sumField = block->getData<ScalarField>(sumFieldID_); - WALBERLA_ASSERT_NOT_NULLPTR( valField ); - WALBERLA_ASSERT_NOT_NULLPTR( sumField ); + WALBERLA_ASSERT_NOT_NULLPTR( valField ) + WALBERLA_ASSERT_NOT_NULLPTR( sumField ) if( init_ ){ auto itSum0 = sumField->beginGhostLayerOnly(stencil::T); @@ -84,8 +84,8 @@ class CompareSweep { ScalarField * sf = block->getData<ScalarField>(smlFieldID_); ScalarField * bf = block->getData<ScalarField>(bigFieldID_); - WALBERLA_ASSERT_NOT_NULLPTR( sf ); - WALBERLA_ASSERT_NOT_NULLPTR( bf ); + WALBERLA_ASSERT_NOT_NULLPTR( sf ) + WALBERLA_ASSERT_NOT_NULLPTR( bf ) const AABB & bb = block->getAABB(); const cell_idx_t offset [3] = { cell_idx_c(bb.min(uint_t(0u))), @@ -96,7 +96,7 @@ class CompareSweep { real_t globalValue = bf->get(i.x()+offset[0],i.y()+offset[1], i.z()+offset[2], i.f()); real_t localValue = *i; - WALBERLA_CHECK_FLOAT_EQUAL(localValue,globalValue); + WALBERLA_CHECK_FLOAT_EQUAL(localValue,globalValue) } } diff --git a/tests/blockforest/communication/GhostLayerCommTest.cpp b/tests/blockforest/communication/GhostLayerCommTest.cpp index df97936c4f95c3eb98c0ab167c38186c93ebfd5b..932ec08768f2d3154186b96667ae34d4b9ff1a11 100644 --- a/tests/blockforest/communication/GhostLayerCommTest.cpp +++ b/tests/blockforest/communication/GhostLayerCommTest.cpp @@ -60,8 +60,8 @@ class StreamingSweep PdfField * src = block->getData<PdfField>(src_); PdfField * dst = block->getData<PdfField>(dst_); - WALBERLA_ASSERT_NOT_NULLPTR( src ); - WALBERLA_ASSERT_NOT_NULLPTR( dst ); + WALBERLA_ASSERT_NOT_NULLPTR( src ) + WALBERLA_ASSERT_NOT_NULLPTR( dst ) for(PdfField::iterator i = dst->begin(); i != dst->end(); ++i ) { @@ -167,7 +167,7 @@ class CompareSweep { real_t globalValue = bf->get(i.x()+offset[0],i.y()+offset[1], i.z()+offset[2], i.f()); real_t localValue = *i; - WALBERLA_CHECK_FLOAT_EQUAL(localValue,globalValue); + WALBERLA_CHECK_FLOAT_EQUAL(localValue,globalValue) } } @@ -241,10 +241,10 @@ int main(int argc, char **argv) const Cell & cell = cellIt.cell(); *cellIt = real_c( ( cell[0] + cell[1] + cell[2] + cellIt.f() ) % cell_idx_t(42) ); glbDst->get(cellIt) = *cellIt; - WALBERLA_CHECK_FLOAT_EQUAL ( (*glbDst)(cell[0],cell[1],cell[2],cellIt.f()), (*glbSrc)(cell[0],cell[1],cell[2],cellIt.f()) ); + WALBERLA_CHECK_FLOAT_EQUAL ( (*glbDst)(cell[0],cell[1],cell[2],cellIt.f()), (*glbSrc)(cell[0],cell[1],cell[2],cellIt.f()) ) } - WALBERLA_LOG_INFO("Initialization complete"); + WALBERLA_LOG_INFO("Initialization complete") } // Create TimeLoop diff --git a/tests/lbm/CMakeLists.txt b/tests/lbm/CMakeLists.txt index 0932fb793b574e1433800cc6a3752904d8389a8e..d34cb0684b80ba7292dcf616c5c9a25cf2efd98f 100644 --- a/tests/lbm/CMakeLists.txt +++ b/tests/lbm/CMakeLists.txt @@ -64,8 +64,11 @@ waLBerla_execute_test( NAME PermeabilityTest_TRT_64_1 COMMAND $<TARGET_FILE:Perm waLBerla_execute_test( NAME PermeabilityTest_TRT_64_4 COMMAND $<TARGET_FILE:PermeabilityTest> --length 64 --kappa 0.85 --omega 0.3 --collisionModel TRT --timesteps 1001 --epsilon 0.025 PROCESSES 4 CONFIGURATIONS Release RelWithDbgInfo ) waLBerla_execute_test( NAME PermeabilityTest_TRT_64_8 COMMAND $<TARGET_FILE:PermeabilityTest> --length 64 --kappa 0.85 --omega 0.3 --collisionModel TRT --timesteps 1001 --epsilon 0.025 PROCESSES 8 CONFIGURATIONS Release RelWithDbgInfo ) -waLBerla_compile_test( FILES initializer/PdfFieldInitializerTest.cpp ) -waLBerla_execute_test( NAME PdfFieldInitializerTest COMMAND $<TARGET_FILE:PdfFieldInitializerTest> ${CMAKE_CURRENT_SOURCE_DIR}/PdfFieldInitializerTest.prm PROCESSES 4 CONFIGURATIONS Release RelWithDbgInfo ) +waLBerla_compile_test( FILES initializer/UniformPdfFieldInitializerTest.cpp ) +waLBerla_execute_test( NAME UniformPdfFieldInitializerTest COMMAND $<TARGET_FILE:UniformPdfFieldInitializerTest> ${CMAKE_CURRENT_SOURCE_DIR}/PdfFieldInitializerTest.prm PROCESSES 4 CONFIGURATIONS Release RelWithDbgInfo ) + +waLBerla_compile_test( FILES initializer/NonUniformPdfFieldInitializerTest.cpp ) +waLBerla_execute_test( NAME NonUniformPdfFieldInitializerTest CONFIGURATIONS Release RelWithDbgInfo ) waLBerla_compile_test( FILES field/QCriterionTest.cpp DEPENDS field blockforest ) waLBerla_execute_test( NAME QCriterionTest ) diff --git a/tests/lbm/initializer/NonUniformPdfFieldInitializerTest.cpp b/tests/lbm/initializer/NonUniformPdfFieldInitializerTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa0775bd0a95af50becae2fd0d36545a55bc3a3a --- /dev/null +++ b/tests/lbm/initializer/NonUniformPdfFieldInitializerTest.cpp @@ -0,0 +1,154 @@ +//====================================================================================================================== +// +// This file is part of waLBerla. waLBerla is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// waLBerla is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NonUniformPdfFieldInitializerTest.cpp +//! \author Helen Schottenhamml <helen.schottenhamml@fau.de> +// +//====================================================================================================================== + + +#include "blockforest/all.h" +#include "core/all.h" +#include "domain_decomposition/all.h" +#include "field/all.h" +#include "lbm/all.h" + +#include <vector> +#include <string> +#include <sstream> + + +namespace walberla { + + +using LatticeModel_T = lbm::D3Q19<lbm::collision_model::SRT>; +using PdfField_T = lbm::PdfField<LatticeModel_T>; +using PdfFieldInitializer_T = lbm::initializer::PdfFieldInitializer<LatticeModel_T>; + +static void refinementSelectionFunction( SetupBlockForest& forest ) { + + SetupBlock* block = forest.getRootBlock( 0 ); + + if( !block->hasChildren() ) + block->setMarker( true ); +} + +static void workloadMemorySUIDAssignmentFunction( SetupBlockForest& forest ) { + + std::vector< SetupBlock* > blocks; + forest.getBlocks( blocks ); + + for( uint_t i = 0; i != blocks.size(); ++i ) { + blocks[i]->setMemory( 1.0 ); + blocks[i]->setWorkload( 1.0 ); + } +} + + +struct LinearDensityCellProfile +{ + real_t operator()( const Cell & globalCell ) const + { + return real_t(1.0) + real_t(0.5) * real_c( globalCell.x() ); + } +}; + +struct LinearDensityCenterProfile +{ + real_t operator()( const Vector3<real_t> & center ) const + { + return real_t(1.0) + real_t(0.5) * center[0]; + } +}; + + +template<typename InitFunc> +void testCellInit( const BlockDataID & pdfFieldId, const shared_ptr<StructuredBlockForest> & blocks ) +{ + lbm::initializer::PdfFieldInitializer< LatticeModel_T > initializer( pdfFieldId, blocks ); + + InitFunc linearDensityProfile; + initializer.initDensity( linearDensityProfile ); + + /// check for cells in ghost layers between coarse and fine blocks + + // get neighbouring coarse and fine block + auto coarseBlock = blocks->getBlock(real_t(15), real_t(5), real_t(5)); + auto fineBlock = blocks->getBlock(real_t(7.5), real_t(2.5), real_t(2.5)); + + // retrieve fields + auto coarsePdfField = coarseBlock->getData<PdfField_T>(pdfFieldId); + auto finePdfField = fineBlock->getData<PdfField_T>(pdfFieldId); + WALBERLA_ASSERT_NOT_NULLPTR(coarseBlock) + WALBERLA_ASSERT_NOT_NULLPTR(fineBlock) + + // ghost layers in coarse block + CellInterval coarseGL; + coarsePdfField->getGhostRegion(stencil::directionFromAxis(0, true), coarseGL, 1); + CellInterval fineInner; + finePdfField->getSliceBeforeGhostLayer(stencil::directionFromAxis(0, false), fineInner, 2); + + Cell fineCellXMin {fineInner.xMin(), fineInner.yMin(), fineInner.zMin()}; + auto fineValXMin = finePdfField->getDensity(fineCellXMin); + + Cell fineCellXMax {fineInner.xMax(), fineInner.yMin(), fineInner.zMin()}; + auto fineValXMax = finePdfField->getDensity(fineCellXMax); + + Cell coarseCell {coarseGL.xMin(), coarseGL.yMin(), coarseGL.zMin()}; + auto coarseVal = coarsePdfField->getDensity(coarseCell); + + WALBERLA_CHECK_FLOAT_EQUAL(coarseVal, real_t(0.5) * (fineValXMin + fineValXMax)) +} + +int main( int argc, char ** argv ) +{ + debug::enterTestMode(); + mpi::Environment env( argc, argv ); + + if( !walberla::MPIManager::instance()->rankValid() ) + walberla::MPIManager::instance()->useWorldComm(); + + SetupBlockForest sforest; + + sforest.addRefinementSelectionFunction( refinementSelectionFunction ); + sforest.addWorkloadMemorySUIDAssignmentFunction( workloadMemorySUIDAssignmentFunction ); + + AABB domain( 0, 0, 0, 20, 10, 10 ); + sforest.init( domain, 2, 1, 1, true, false, false ); + sforest.assignAllBlocksToRootProcess(); + + sforest.writeVTKOutput("initialDomainDecomposition"); + + // setup StructuredBlockForest + + auto blocks = std::make_shared<StructuredBlockForest>( std::make_shared< BlockForest >( 0, sforest, true ), 10, 10, 10 ); + blocks->createCellBoundingBoxes(); + + + LatticeModel_T lm( real_c(1) ); + + BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf_field", lm ); + + testCellInit<LinearDensityCellProfile>(pdfFieldId, blocks); + testCellInit<LinearDensityCenterProfile>(pdfFieldId, blocks); + + return 0; +} +} + +int main( int argc, char ** argv ) +{ + return walberla::main(argc, argv); +} \ No newline at end of file diff --git a/tests/lbm/initializer/PdfFieldInitializerTest.cpp b/tests/lbm/initializer/UniformPdfFieldInitializerTest.cpp similarity index 92% rename from tests/lbm/initializer/PdfFieldInitializerTest.cpp rename to tests/lbm/initializer/UniformPdfFieldInitializerTest.cpp index 5e8b2ac39dfc2ef78f5e59d6f7a7587d311ea2d3..6219b4019617c97c8284ee618b844f630056b599 100644 --- a/tests/lbm/initializer/PdfFieldInitializerTest.cpp +++ b/tests/lbm/initializer/UniformPdfFieldInitializerTest.cpp @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License along // with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file PdfFieldInitializerTest.cpp +//! \file UniformPdfFieldInitializerTest.cpp //! \author Tobias Schruff <tobias.schruff@gmail.com> // //====================================================================================================================== @@ -106,14 +106,14 @@ void testDensityInit( const BlockDataID & pdfFieldId, const shared_ptr<Structure for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { auto pdfField = blockIt->getData<PdfField_T>( pdfFieldId ); - WALBERLA_ASSERT_NOT_NULLPTR( pdfField ); + WALBERLA_ASSERT_NOT_NULLPTR( pdfField ) for( auto cellIt = pdfField->beginWithGhostLayerXYZ(); cellIt != pdfField->end(); ++cellIt ) { Cell globalCell( cellIt.cell() ); blocks->transformBlockLocalToGlobalCell( globalCell, *blockIt ); - WALBERLA_CHECK_FLOAT_EQUAL( pdfField->getDensity( cellIt.cell() ), densityInit( globalCell ) ); + WALBERLA_CHECK_FLOAT_EQUAL( pdfField->getDensity( cellIt.cell() ), densityInit( globalCell ) ) } } } @@ -131,7 +131,7 @@ void testVelocityInit( const BlockDataID & pdfFieldId, const shared_ptr<Structur for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { auto pdfField = blockIt->getData<PdfField_T>( pdfFieldId ); - WALBERLA_ASSERT_NOT_NULLPTR( pdfField ); + WALBERLA_ASSERT_NOT_NULLPTR( pdfField ) for( auto cellIt = pdfField->beginWithGhostLayerXYZ(); cellIt != pdfField->end(); ++cellIt ) { @@ -141,9 +141,9 @@ void testVelocityInit( const BlockDataID & pdfFieldId, const shared_ptr<Structur const Vector3<real_t> initV = velocityInit( globalCell ); const Vector3<real_t> fieldV = pdfField->getVelocity( cellIt.cell() ); - WALBERLA_CHECK_FLOAT_EQUAL( initV[0], fieldV[0] ); - WALBERLA_CHECK_FLOAT_EQUAL( initV[1], fieldV[1] ); - WALBERLA_CHECK_FLOAT_EQUAL( initV[2], fieldV[2] ); + WALBERLA_CHECK_FLOAT_EQUAL( initV[0], fieldV[0] ) + WALBERLA_CHECK_FLOAT_EQUAL( initV[1], fieldV[1] ) + WALBERLA_CHECK_FLOAT_EQUAL( initV[2], fieldV[2] ) } } } @@ -161,7 +161,7 @@ void testDensityAndVelocityInit( const BlockDataID & pdfFieldId, const shared_pt for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { auto pdfField = blockIt->getData<PdfField_T>( pdfFieldId ); - WALBERLA_ASSERT_NOT_NULLPTR( pdfField ); + WALBERLA_ASSERT_NOT_NULLPTR( pdfField ) for( auto cellIt = pdfField->beginWithGhostLayerXYZ(); cellIt != pdfField->end(); ++cellIt ) { @@ -172,10 +172,10 @@ void testDensityAndVelocityInit( const BlockDataID & pdfFieldId, const shared_pt const real_t density = pdfField->getDensityAndVelocity( velocity, cellIt.cell() ); const std::vector<real_t> control = densityAndVelocityInit( globalCell ); - WALBERLA_CHECK_FLOAT_EQUAL( control[0], density ); - WALBERLA_CHECK_FLOAT_EQUAL( control[1], velocity[0] ); - WALBERLA_CHECK_FLOAT_EQUAL( control[2], velocity[1] ); - WALBERLA_CHECK_FLOAT_EQUAL( control[3], velocity[2] ); + WALBERLA_CHECK_FLOAT_EQUAL( control[0], density ) + WALBERLA_CHECK_FLOAT_EQUAL( control[1], velocity[0] ) + WALBERLA_CHECK_FLOAT_EQUAL( control[2], velocity[1] ) + WALBERLA_CHECK_FLOAT_EQUAL( control[3], velocity[2] ) } } } @@ -207,7 +207,7 @@ void testDensityAndVelocityInitFromConfig( const BlockDataID & pdfFieldId, const for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { auto pdfField = blockIt->getData<PdfField_T>( pdfFieldId ); - WALBERLA_ASSERT_NOT_NULLPTR( pdfField ); + WALBERLA_ASSERT_NOT_NULLPTR( pdfField ) for( auto cellIt = pdfField->beginWithGhostLayerXYZ(); cellIt != pdfField->end(); ++cellIt ) { @@ -218,10 +218,10 @@ void testDensityAndVelocityInitFromConfig( const BlockDataID & pdfFieldId, const const real_t density = pdfField->getDensityAndVelocity( velocity, cellIt.cell() ); const std::vector<real_t> control = initControl( globalCell ); - WALBERLA_CHECK_FLOAT_EQUAL( control[0], density ); - WALBERLA_CHECK_FLOAT_EQUAL( control[1], velocity[0] ); - WALBERLA_CHECK_FLOAT_EQUAL( control[2], velocity[1] ); - WALBERLA_CHECK_FLOAT_EQUAL( control[3], velocity[2] ); + WALBERLA_CHECK_FLOAT_EQUAL( control[0], density ) + WALBERLA_CHECK_FLOAT_EQUAL( control[1], velocity[0] ) + WALBERLA_CHECK_FLOAT_EQUAL( control[2], velocity[1] ) + WALBERLA_CHECK_FLOAT_EQUAL( control[3], velocity[2] ) } } @@ -235,7 +235,7 @@ int main( int argc, char ** argv ) debug::enterTestMode(); Environment env( argc, argv ); if( !env.config() ) - WALBERLA_ABORT("You have to specify a configuration file!"); + WALBERLA_ABORT("You have to specify a configuration file!") auto blocks = blockforest::createUniformBlockGrid( 2u, 2u, 1u, 5u, 5u, 10u, real_c(1) );