diff --git a/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas.cpp b/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas.cpp index 89fa83851387f7a88b125cf22af5fc85b13617a3..190b13e0d42ad23926e76e7afc3e0ece4f14568f 100644 --- a/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas.cpp +++ b/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas.cpp @@ -21,6 +21,7 @@ #include <pe/basic.h> #include <pe/vtk/SphereVtkOutput.h> +#include <blockforest/Initialization.h> #include <core/Abort.h> #include <core/Environment.h> #include <core/math/Random.h> @@ -99,7 +100,7 @@ int main( int argc, char ** argv ) WALBERLA_LOG_INFO_ON_ROOT("*** BLOCKFOREST ***"); // create forest - shared_ptr< BlockForest > forest = createBlockForestFromConfig( mainConf ); + shared_ptr< BlockForest > forest = blockforest::createBlockForestFromConfig( mainConf ); if (!forest) { WALBERLA_LOG_INFO_ON_ROOT( "No BlockForest created ... exiting!"); diff --git a/apps/tutorials/pe/01_ConfinedGas.cpp b/apps/tutorials/pe/01_ConfinedGas.cpp index 3d9847922fabad67c5b4073665895259969626db..04728547d021d01d076bb1606e4f48680367aeef 100644 --- a/apps/tutorials/pe/01_ConfinedGas.cpp +++ b/apps/tutorials/pe/01_ConfinedGas.cpp @@ -21,6 +21,7 @@ //! [Includes] #include <pe/basic.h> +#include <blockforest/Initialization.h> #include <core/Environment.h> #include <core/grid_generator/HCPIterator.h> #include <core/grid_generator/SCIterator.h> @@ -58,10 +59,10 @@ int main( int argc, char ** argv ) WALBERLA_LOG_INFO_ON_ROOT("*** BLOCKFOREST ***"); // create forest //! [BlockForest] - shared_ptr< BlockForest > forest = createBlockForest( AABB(0,0,0,20,20,20), // simulation domain - Vector3<uint_t>(2,2,2), // blocks in each direction - Vector3<bool>(false, false, false) // periodicity - ); + auto forest = blockforest::createBlockForest( AABB(0,0,0,20,20,20), // simulation domain + Vector3<uint_t>(2,2,2), // blocks in each direction + Vector3<bool>(false, false, false) // periodicity + ); //! [BlockForest] if (!forest) { diff --git a/apps/tutorials/pe/02_ConfinedGasExtended.cpp b/apps/tutorials/pe/02_ConfinedGasExtended.cpp index e1da27b0da9947bc4a9c6361e039f354e04ab84d..2ada237572406c3f30096ab887954a6218c30f45 100644 --- a/apps/tutorials/pe/02_ConfinedGasExtended.cpp +++ b/apps/tutorials/pe/02_ConfinedGasExtended.cpp @@ -23,6 +23,7 @@ #include <pe/vtk/SphereVtkOutput.h> #include <pe/raytracing/Raytracer.h> +#include <blockforest/Initialization.h> #include <core/Abort.h> #include <core/Environment.h> #include <core/grid_generator/HCPIterator.h> @@ -117,7 +118,7 @@ int main( int argc, char ** argv ) WALBERLA_LOG_INFO_ON_ROOT("*** BLOCKFOREST ***"); // create forest - shared_ptr< BlockForest > forest = createBlockForestFromConfig( mainConf ); + shared_ptr< BlockForest > forest = blockforest::createBlockForestFromConfig( mainConf ); if (!forest) { WALBERLA_LOG_INFO_ON_ROOT( "No BlockForest created ... exiting!"); diff --git a/src/blockforest/Initialization.cpp b/src/blockforest/Initialization.cpp index c13896c87c7966d3adc9422828d1006f7be7aa6c..eaf25ffbe3176a7cc1fb4e2b1f7ac15d4ea2e83e 100644 --- a/src/blockforest/Initialization.cpp +++ b/src/blockforest/Initialization.cpp @@ -23,6 +23,7 @@ #include "Initialization.h" #include "SetupBlockForest.h" #include "loadbalancing/Cartesian.h" +#include "loadbalancing/StaticCurve.h" #include "core/Abort.h" #include "core/cell/CellInterval.h" @@ -267,6 +268,131 @@ createBlockForest( const AABB& domainAABB, + +class FixedRefinementLevelSelector +{ +public: + FixedRefinementLevelSelector( const uint_t level ) : level_(level) {} + void operator()( SetupBlockForest& forest ) + { + for( auto block = forest.begin(); block != forest.end(); ++block ) + { + if( block->getLevel() < level_ ) + block->setMarker( true ); + } + } +private: + uint_t level_; +}; + +std::unique_ptr<SetupBlockForest> createSetupBlockForest(const math::AABB& simulationDomain, + Vector3<uint_t> blocks, + const Vector3<bool>& isPeriodic, + const uint_t numberOfProcesses, + const uint_t initialRefinementLevel) +{ + WALBERLA_MPI_SECTION() + { + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); + } + + auto sforest = std::make_unique<SetupBlockForest>( ); + sforest->addWorkloadMemorySUIDAssignmentFunction( blockforest::uniformWorkloadAndMemoryAssignment ); + sforest->addRefinementSelectionFunction( FixedRefinementLevelSelector(initialRefinementLevel) ); + sforest->init( simulationDomain, blocks[0], blocks[1], blocks[2], isPeriodic[0], isPeriodic[1], isPeriodic[2] ); + + WALBERLA_LOG_INFO_ON_ROOT( "Balancing " << sforest->getNumberOfBlocks() << " blocks for " << numberOfProcesses << " processes..."); + + sforest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, real_t(0), memory_t(0), false, true ); + return sforest; +} + +shared_ptr<BlockForest> createBlockForest(const math::AABB& simulationDomain, + const Vector3<uint_t>& blocks, + const Vector3<bool>& isPeriodic, + const uint_t numberOfProcesses, + const uint_t initialRefinementLevel, + const bool keepGlobalBlockInformation) +{ + WALBERLA_MPI_SECTION() + { + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); + } + + std::unique_ptr<SetupBlockForest> sforest( createSetupBlockForest( simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel )); + return std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), *sforest, keepGlobalBlockInformation ); +} + +shared_ptr<BlockForest> createBlockForest(const math::AABB& simulationDomain, + const Vector3<uint_t>& blocks, + const Vector3<bool>& isPeriodic, + const bool setupRun, + const std::string& sbffile, + const uint_t numberOfProcesses, + const uint_t initialRefinementLevel, + const bool keepGlobalBlockInformation ) +{ + if (setupRun) + { + WALBERLA_LOG_INFO_ON_ROOT("Setup run. For production run specify 'setupRun = false'"); + + if( MPIManager::instance()->numProcesses() > 1 ) + WALBERLA_LOG_WARNING_ON_ROOT( "Setup run with more than one process! Only root is doing work! I hope you know what you are doing!" ); + + WALBERLA_ROOT_SECTION() + { + WALBERLA_LOG_INFO_ON_ROOT( "Creating the block structure ..." ); + + std::unique_ptr<SetupBlockForest> sforest( createSetupBlockForest(simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel) ); + sforest->saveToFile( sbffile.c_str() ); + + WALBERLA_LOG_INFO_ON_ROOT( "SetupBlockForest successfully saved to file!" ); + } + + return shared_ptr<BlockForest>(); + } + + WALBERLA_MPI_SECTION() + { + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); + } + + WALBERLA_LOG_INFO_ON_ROOT( "Production Run!" ); + WALBERLA_LOG_INFO_ON_ROOT( "Creating the block structure: loading from file \'" << sbffile << "\' ..." ); + return std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, keepGlobalBlockInformation ); +} + + +shared_ptr<BlockForest> createBlockForestFromConfig(const Config::BlockHandle& mainConf, + const bool keepGlobalBlockInformation) +{ + bool setupRun = mainConf.getParameter< bool >( "setupRun", false ); + Vector3<real_t> simulationCorner = mainConf.getParameter<Vector3<real_t>>("simulationCorner", Vector3<real_t>(0, 0, 0)); + Vector3<real_t> simulationSize = mainConf.getParameter<Vector3<real_t>>("simulationDomain", Vector3<real_t>(10, 10, 10)); + math::AABB simulationDomain = math::AABB( simulationCorner, simulationCorner + simulationSize ); + Vector3<uint_t> blocks = mainConf.getParameter<Vector3<uint_t>>("blocks", Vector3<uint_t>(3, 3, 3)); + Vector3<bool> isPeriodic = mainConf.getParameter<Vector3<bool>>("isPeriodic", Vector3<bool>(true, true, true)); + uint_t numberOfProcesses = mainConf.getParameter<uint_t>( "numberOfProcesses", + setupRun ? blocks[0] * blocks[1] * blocks[2] : uint_c(mpi::MPIManager::instance()->numProcesses()) ); + uint_t initialRefinementLevel = mainConf.getParameter<uint_t>( "initialRefinementLevel", uint_t(0) ); + + if( !mainConf.isDefined( "sbfFile" ) ) + { + WALBERLA_LOG_INFO_ON_ROOT( "No setup file specified: Creation without setup file!" ); + return createBlockForest(simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel, keepGlobalBlockInformation); + } + + // sbf file given -> try to load or save domain decomposition + std::string sbffile = mainConf.getParameter< std::string >( "sbfFile" ); + WALBERLA_LOG_INFO_ON_ROOT( "Setup file specified: Using " << sbffile ); + return createBlockForest(simulationDomain, blocks, isPeriodic, setupRun, sbffile, numberOfProcesses, initialRefinementLevel, keepGlobalBlockInformation); +} + + + //********************************************************************************************************************** /*! * \brief Function for creating a structured block forest that represents a uniform block grid. diff --git a/src/blockforest/Initialization.h b/src/blockforest/Initialization.h index 4129ff79b0760ccf0d079a86498ee65ade0db399..3a87f28117e09f46333bce69c72c776f3da18027 100644 --- a/src/blockforest/Initialization.h +++ b/src/blockforest/Initialization.h @@ -24,6 +24,7 @@ #include "StructuredBlockForest.h" #include "core/config/Config.h" +#include "core/mpi/MPIManager.h" @@ -48,6 +49,26 @@ createBlockForest( const AABB& domainAABB, const uint_t numberOfXProcesses, const uint_t numberOfYProcesses, const uint_t numberOfZProcesses, const bool xPeriodic = false, const bool yPeriodic = false, const bool zPeriodic = false, const bool keepGlobalBlockInformation = false ); +shared_ptr<BlockForest> +createBlockForest(const math::AABB& simulationDomain, + const Vector3<uint_t>& blocks, + const Vector3<bool>& isPeriodic, + const uint_t numberOfProcesses = uint_c(mpi::MPIManager::instance()->numProcesses()), + const uint_t initialRefinementLevel = uint_t(0), + const bool keepGlobalBlockInformation = false); +shared_ptr<BlockForest> +createBlockForest(const math::AABB& simulationDomain, + const Vector3<uint_t>& blocks, + const Vector3<bool>& isPeriodic, + const bool setupRun, + const std::string& sbffile, + const uint_t numberOfProcesses = uint_c(mpi::MPIManager::instance()->numProcesses()), + const uint_t initialRefinementLevel = uint_t(0), + const bool keepGlobalBlockInformation = false); +shared_ptr<BlockForest> +createBlockForestFromConfig(const Config::BlockHandle& mainConf, + const bool keepGlobalBlockInformation = false); + shared_ptr< StructuredBlockForest > createUniformBlockGrid( const AABB& domainAABB, const uint_t numberOfXBlocks, const uint_t numberOfYBlocks, const uint_t numberOfZBlocks, diff --git a/src/pe/basic.h b/src/pe/basic.h index 08051705953cf2e5641188942c29a11e0c0cf7ec..600854173e68aa922f0bf1413ceb9b6e26a63e2b 100644 --- a/src/pe/basic.h +++ b/src/pe/basic.h @@ -49,5 +49,4 @@ #include "pe/synchronization/SyncNextNeighbors.h" #include "pe/synchronization/SyncShadowOwners.h" -#include "pe/utility/CreateWorld.h" #include "pe/utility/GetBody.h" diff --git a/src/pe/utility/CreateWorld.cpp b/src/pe/utility/CreateWorld.cpp deleted file mode 100644 index 377473c657eff7436d5bef50a6683b5acf30a900..0000000000000000000000000000000000000000 --- a/src/pe/utility/CreateWorld.cpp +++ /dev/null @@ -1,176 +0,0 @@ -//====================================================================================================================== -// -// 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 CreateWorld.cpp -//! \author Sebastian Eibl <sebastian.eibl@fau.de> -// -//====================================================================================================================== - -//************************************************************************************************* -// Includes -//************************************************************************************************* - -#include "CreateWorld.h" - -#include <pe/Types.h> - -#include <blockforest/Initialization.h> -#include <blockforest/loadbalancing/StaticCurve.h> -#include <blockforest/SetupBlockForest.h> -#include <core/logging/Logging.h> -#include <core/math/AABB.h> - -#include <memory> - -namespace walberla { -namespace pe { - -class FixedRefinementLevelSelector -{ -public: - FixedRefinementLevelSelector( const uint_t level ) : level_(level) {} - void operator()( SetupBlockForest& forest ) - { - for( auto block = forest.begin(); block != forest.end(); ++block ) - { - if( block->getLevel() < level_ ) - block->setMarker( true ); - } - } -private: - uint_t level_; -}; - -std::unique_ptr<SetupBlockForest> createSetupBlockForest(const math::AABB& simulationDomain, - Vector3<uint_t> blocks, - const Vector3<bool>& isPeriodic, - const uint_t numberOfProcesses, - const uint_t initialRefinementLevel) -{ - WALBERLA_MPI_SECTION() - { - if (!MPIManager::instance()->rankValid()) - MPIManager::instance()->useWorldComm(); - } - - if (isPeriodic[0] && blocks[0]<2) - { - WALBERLA_LOG_WARNING_ON_ROOT( "To few blocks in periodic x direction (" << blocks[0] << ")! Setting to 2..." ); - blocks[0] = 2; - } - if (isPeriodic[1] && blocks[1]<2) - { - WALBERLA_LOG_WARNING_ON_ROOT( "To few blocks in periodic y direction (" << blocks[1] << ")! Setting to 2..." ); - blocks[1] = 2; - } - if (isPeriodic[2] && blocks[2]<2) - { - WALBERLA_LOG_WARNING_ON_ROOT( "To few blocks in periodic z direction (" << blocks[2] << ")! Setting to 2..." ); - blocks[2] = 2; - } - - auto sforest = std::make_unique<SetupBlockForest>( ); - sforest->addWorkloadMemorySUIDAssignmentFunction( blockforest::uniformWorkloadAndMemoryAssignment ); - sforest->addRefinementSelectionFunction( FixedRefinementLevelSelector(initialRefinementLevel) ); - sforest->init( simulationDomain, blocks[0], blocks[1], blocks[2], isPeriodic[0], isPeriodic[1], isPeriodic[2] ); - - WALBERLA_LOG_INFO_ON_ROOT( "Balancing " << sforest->getNumberOfBlocks() << " blocks for " << numberOfProcesses << " processes..."); - - sforest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, real_t(0), memory_t(0), false, true ); - return sforest; -} - -shared_ptr<BlockForest> createBlockForest(const math::AABB& simulationDomain, - const Vector3<uint_t>& blocks, - const Vector3<bool>& isPeriodic, - const uint_t numberOfProcesses, - const uint_t initialRefinementLevel) -{ - WALBERLA_MPI_SECTION() - { - if (!MPIManager::instance()->rankValid()) - MPIManager::instance()->useWorldComm(); - } - - std::unique_ptr<SetupBlockForest> sforest( createSetupBlockForest( simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel )); - return std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), *sforest, false ); -} - -shared_ptr<BlockForest> createBlockForest(const math::AABB& simulationDomain, - const Vector3<uint_t>& blocks, - const Vector3<bool>& isPeriodic, - const bool setupRun, - const std::string& sbffile, - const uint_t numberOfProcesses, - const uint_t initialRefinementLevel) -{ - if (setupRun) - { - WALBERLA_LOG_INFO_ON_ROOT("Setup run. For production run specify 'setupRun = false'"); - - if( MPIManager::instance()->numProcesses() > 1 ) - WALBERLA_LOG_WARNING_ON_ROOT( "Setup run with more than one process! Only root is doing work! I hope you know what you are doing!" ); - - WALBERLA_ROOT_SECTION() - { - WALBERLA_LOG_INFO_ON_ROOT( "Creating the block structure ..." ); - - std::unique_ptr<SetupBlockForest> sforest( createSetupBlockForest(simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel) ); - sforest->saveToFile( sbffile.c_str() ); - - WALBERLA_LOG_INFO_ON_ROOT( "SetupBlockForest successfully saved to file!" ); - } - - return shared_ptr<BlockForest>(); - } - - WALBERLA_MPI_SECTION() - { - if (!MPIManager::instance()->rankValid()) - MPIManager::instance()->useWorldComm(); - } - - WALBERLA_LOG_INFO_ON_ROOT( "Production Run!" ); - WALBERLA_LOG_INFO_ON_ROOT( "Creating the block structure: loading from file \'" << sbffile << "\' ..." ); - return std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ); -} - - -shared_ptr<BlockForest> createBlockForestFromConfig(const Config::BlockHandle& mainConf) -{ - bool setupRun = mainConf.getParameter< bool >( "setupRun", false ); - Vec3 simulationCorner = mainConf.getParameter<Vec3>("simulationCorner", Vec3(0, 0, 0)); - Vec3 simulationSize = mainConf.getParameter<Vec3>("simulationDomain", Vec3(10, 10, 10)); - math::AABB simulationDomain = math::AABB( simulationCorner, simulationCorner + simulationSize ); - Vector3<uint_t> blocks = mainConf.getParameter<Vector3<uint_t>>("blocks", Vector3<uint_t>(3, 3, 3)); - Vector3<bool> isPeriodic = mainConf.getParameter<Vector3<bool>>("isPeriodic", Vector3<bool>(true, true, true)); - uint_t numberOfProcesses = mainConf.getParameter<uint_t>( "numberOfProcesses", - setupRun ? blocks[0] * blocks[1] * blocks[2] : uint_c(mpi::MPIManager::instance()->numProcesses()) ); - uint_t initialRefinementLevel = mainConf.getParameter<uint_t>( "initialRefinementLevel", uint_t(0) ); - - if( !mainConf.isDefined( "sbfFile" ) ) - { - WALBERLA_LOG_INFO_ON_ROOT( "No setup file specified: Creation without setup file!" ); - return createBlockForest(simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel); - } - - // sbf file given -> try to load or save domain decomposition - std::string sbffile = mainConf.getParameter< std::string >( "sbfFile" ); - WALBERLA_LOG_INFO_ON_ROOT( "Setup file specified: Using " << sbffile ); - return createBlockForest(simulationDomain, blocks, isPeriodic, setupRun, sbffile, numberOfProcesses, initialRefinementLevel); -} - -} // namespace pe -} // namespace walberla diff --git a/src/pe/utility/CreateWorld.h b/src/pe/utility/CreateWorld.h deleted file mode 100644 index 1cfec49c2ca45fa89c9e960f07d67a0f3fb184c2..0000000000000000000000000000000000000000 --- a/src/pe/utility/CreateWorld.h +++ /dev/null @@ -1,50 +0,0 @@ -//====================================================================================================================== -// -// 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 CreateWorld.h -//! \author Sebastian Eibl <sebastian.eibl@fau.de> -// -//====================================================================================================================== - -#pragma once - -//************************************************************************************************* -// Includes -//************************************************************************************************* - -#include "blockforest/BlockForest.h" -#include "core/config/Config.h" -#include "core/DataTypes.h" -#include <core/mpi/MPIManager.h> - -namespace walberla { -namespace pe { - -shared_ptr<BlockForest> createBlockForest(const math::AABB& simulationDomain, - const Vector3<uint_t>& blocks, - const Vector3<bool>& isPeriodic, - const uint_t numberOfProcesses = uint_c(mpi::MPIManager::instance()->numProcesses()), - const uint_t initialRefinementLevel = uint_t(0)); -shared_ptr<BlockForest> createBlockForest(const math::AABB& simulationDomain, - const Vector3<uint_t>& blocks, - const Vector3<bool>& isPeriodic, - const bool setupRun, - const std::string& sbffile, - const uint_t numberOfProcesses = uint_c(mpi::MPIManager::instance()->numProcesses()), - const uint_t initialRefinementLevel = uint_t(0)); -shared_ptr<BlockForest> createBlockForestFromConfig(const Config::BlockHandle& mainConf); - -} // namespace pe -} // namespace walberla diff --git a/tests/mesh/PeVTKMeshWriterTest.cpp b/tests/mesh/PeVTKMeshWriterTest.cpp index b3b704a97a585891a7ff4a9a4d548252fd8ce44e..30045036c3046de60e940d1242aed01b912c8c0a 100644 --- a/tests/mesh/PeVTKMeshWriterTest.cpp +++ b/tests/mesh/PeVTKMeshWriterTest.cpp @@ -31,6 +31,7 @@ #include <mesh/pe/communication/ConvexPolyhedron.h> #include <mesh/PolyMeshes.h> +#include <blockforest/Initialization.h> #include <core/Abort.h> #include <core/Environment.h> #include <core/grid_generator/HCPIterator.h> @@ -128,8 +129,8 @@ int main( int argc, char ** argv ) shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr< BlockForest > forest = createBlockForest( AABB( real_t(0), real_t(0), real_t(0), real_t(6), real_t(6), real_t(6) ), - Vector3<uint_t>( uint_t(2) ), Vector3<bool>( false ) ); + auto forest = blockforest::createBlockForest( AABB( real_t(0), real_t(0), real_t(0), real_t(6), real_t(6), real_t(6) ), + Vector3<uint_t>( uint_t(2) ), Vector3<bool>( false ) ); SetBodyTypeIDs<BodyTuple>::execute(); diff --git a/tests/pe/Callback.cpp b/tests/pe/Callback.cpp index 7aa026672ddf177fb130e061a71d2e80ce5d3015..220c026024699df108d677caa908b8891bd4de69 100644 --- a/tests/pe/Callback.cpp +++ b/tests/pe/Callback.cpp @@ -22,11 +22,9 @@ #include "pe/basic.h" #include <pe/utility/DestroyBody.h> -#include "blockforest/all.h" -#include "core/all.h" -#include "domain_decomposition/all.h" - +#include "blockforest/Initialization.h" #include "core/debug/TestSubsystem.h" +#include "core/Environment.h" namespace walberla { using namespace walberla::pe; @@ -74,10 +72,10 @@ int main( int argc, char** argv ) shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); // create blocks - shared_ptr< BlockForest > forest = createBlockForest( AABB(0,0,0,20,20,20), // simulation domain - Vector3<uint_t>(2,1,1), // blocks in each direction - Vector3<bool>(false, false, false) // periodicity - ); + auto forest = blockforest::createBlockForest( AABB(0,0,0,20,20,20), // simulation domain + Vector3<uint_t>(2,1,1), // blocks in each direction + Vector3<bool>(false, false, false) // periodicity + ); SetBodyTypeIDs<BodyTypeTuple>::execute(); diff --git a/tests/pe/CreateWorld.cpp b/tests/pe/CreateWorld.cpp index a31fb258434a93adf39131cec7dedf30bbdccc9b..04937a603fbdf37649ac86acbd576a9764833211 100644 --- a/tests/pe/CreateWorld.cpp +++ b/tests/pe/CreateWorld.cpp @@ -20,11 +20,10 @@ //====================================================================================================================== #include "pe/basic.h" -#include "pe/utility/CreateWorld.h" -#include "blockforest/all.h" -#include "core/all.h" -#include "domain_decomposition/all.h" +#include "blockforest/Initialization.h" +#include "core/debug/TestSubsystem.h" +#include "core/Environment.h" #include "core/debug/TestSubsystem.h" @@ -40,12 +39,11 @@ int main( int argc, char** argv ) WALBERLA_UNUSED(env); // create blocks - auto forest = createBlockForest( - math::AABB(0,0,0,10,10,10), - Vector3<uint_t>(1,1,1), - Vector3<bool>(false, false, false), - 1, - 1); + auto forest = blockforest::createBlockForest( math::AABB(0,0,0,10,10,10), + Vector3<uint_t>(1,1,1), + Vector3<bool>(false, false, false), + 1, + 1); WALBERLA_CHECK_EQUAL( forest->size(), 8); for (auto blockIt = forest->begin(); blockIt != forest->end(); ++blockIt) @@ -61,4 +59,4 @@ int main( int argc, char** argv ) int main( int argc, char* argv[] ) { return walberla::main( argc, argv ); -} \ No newline at end of file +} diff --git a/tests/pe/LoadFromConfig.cpp b/tests/pe/LoadFromConfig.cpp index 7e3236205412c41c87016d69a628a790c72c6a89..1e22cd6fc88044c70db2595935adebfb625143bb 100644 --- a/tests/pe/LoadFromConfig.cpp +++ b/tests/pe/LoadFromConfig.cpp @@ -19,12 +19,11 @@ //====================================================================================================================== -#include "blockforest/all.h" -#include "core/all.h" -#include "domain_decomposition/all.h" +#include "blockforest/Initialization.h" +#include "core/debug/TestSubsystem.h" +#include "core/Environment.h" #include "pe/basic.h" -#include "pe/utility/CreateWorld.h" #include "core/debug/TestSubsystem.h" @@ -53,7 +52,7 @@ int main( int argc, char ** argv ) // create blocks //! [Config BlockForest] - shared_ptr<BlockForest> forest = createBlockForestFromConfig( configBlock ); + shared_ptr<BlockForest> forest = blockforest::createBlockForestFromConfig( configBlock ); //! [Config BlockForest] WALBERLA_CHECK_EQUAL( forest->getXSize(), 3 ); WALBERLA_CHECK_EQUAL( forest->getYSize(), 4 ); @@ -82,4 +81,4 @@ int main( int argc, char ** argv ) int main( int argc, char* argv[] ) { return walberla::main( argc, argv ); -} \ No newline at end of file +} diff --git a/tests/pe/ParMetis.cpp b/tests/pe/ParMetis.cpp index 3314d98a2c0b5d8d343f6876a5826b88e7cdae57..4ca23d4e60fff3b57ee190d587adf1edc20b637d 100644 --- a/tests/pe/ParMetis.cpp +++ b/tests/pe/ParMetis.cpp @@ -18,8 +18,7 @@ // //====================================================================================================================== -#include "pe/utility/CreateWorld.h" - +#include "blockforest/Initialization.h" #include <blockforest/loadbalancing/DynamicParMetis.h> #include <core/debug/TestSubsystem.h> #include <core/Environment.h> @@ -27,7 +26,6 @@ #include <core/math/Sample.h> using namespace walberla; -using namespace walberla::pe; class ReGrid { @@ -78,11 +76,11 @@ int parmetisTest(const std::string& algorithm, WALBERLA_LOG_INFO_ON_ROOT("****** " << algorithm << " | " << weightsToUse << " | " << edgeSource); // create forest - shared_ptr< BlockForest > forest = createBlockForest( math::AABB(0,0,0,40,40,40), - Vector3<uint_t>(4, 4, 4), - Vector3<bool>(false, false, false), - 64, - 0); + auto forest = blockforest::createBlockForest( math::AABB(0,0,0,40,40,40), + Vector3<uint_t>(4, 4, 4), + Vector3<bool>(false, false, false), + 64, + 0); if (!forest) { WALBERLA_LOG_INFO_ON_ROOT( "No BlockForest created ... exiting!"); diff --git a/tests/pe/Raytracing.cpp b/tests/pe/Raytracing.cpp index 16b27ed20d69970f5e814be74adf8b4b92648004..e8f0f505a8313212c4895341a7ac7784234511d1 100644 --- a/tests/pe/Raytracing.cpp +++ b/tests/pe/Raytracing.cpp @@ -13,6 +13,7 @@ #include "pe/rigidbody/SetBodyTypeIDs.h" #include "pe/Types.h" +#include "blockforest/Initialization.h" #include "core/debug/TestSubsystem.h" #include "core/DataTypes.h" #include <core/math/Random.h> @@ -272,7 +273,7 @@ ShadingParameters customBodyToShadingParams(const BodyID body) { void RaytracerTest(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RAYTRACE_HASHGRIDS, walberla::uint8_t antiAliasFactor = 1) { WALBERLA_LOG_INFO("Raytracer"); shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr<BlockForest> forest = createBlockForest(AABB(0,0,0,10,10,10), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); + auto forest = blockforest::createBlockForest(AABB(0,0,0,10,10,10), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); auto ccdID = forest->addBlockData(ccd::createHashGridsDataHandling( globalBodyStorage, storageID ), "CCD"); @@ -378,7 +379,7 @@ ShadingParameters customSpheresBodyToShadingParams(const BodyID body) { void RaytracerSpheresTestScene(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RAYTRACE_HASHGRIDS, walberla::uint8_t antiAliasFactor = 1) { WALBERLA_LOG_INFO("Raytracer Spheres Scene"); shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr<BlockForest> forest = createBlockForest(AABB(0,0,0,10,10,10), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); + auto forest = blockforest::createBlockForest(AABB(0,0,0,10,10,10), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); auto ccdID = forest->addBlockData(ccd::createHashGridsDataHandling( globalBodyStorage, storageID ), "CCD"); @@ -438,7 +439,7 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a tt.start("Setup"); shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr<BlockForest> forest = createBlockForest(AABB(0,0,0,4,4,4), Vector3<uint_t>(2,3,1), Vector3<bool>(false, false, false)); + auto forest = blockforest::createBlockForest(AABB(0,0,0,4,4,4), Vector3<uint_t>(2,3,1), Vector3<bool>(false, false, false)); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); auto ccdID = forest->addBlockData(ccd::createHashGridsDataHandling(globalBodyStorage, storageID), "CCD"); @@ -637,7 +638,7 @@ void HashGridsArtifactsTest(Raytracer::Algorithm raytracingAlgorithm, walberla:: WALBERLA_LOG_INFO(" Generating " << boxes << " boxes"); shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr<BlockForest> forest = createBlockForest(AABB(0,0,0,4,4,4), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); + auto forest = blockforest::createBlockForest(AABB(0,0,0,4,4,4), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); auto ccdID = forest->addBlockData(ccd::createHashGridsDataHandling(globalBodyStorage, storageID), "CCD"); @@ -678,7 +679,7 @@ void HashGridsFromNegativeArtifactsTest(Raytracer::Algorithm raytracingAlgorithm WALBERLA_LOG_INFO_ON_ROOT(" Generating " << boxes << " boxes"); shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr<BlockForest> forest = createBlockForest(AABB(0,0,0,4,4,4), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); + auto forest = blockforest::createBlockForest(AABB(0,0,0,4,4,4), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); auto ccdID = forest->addBlockData(ccd::createHashGridsDataHandling(globalBodyStorage, storageID), "CCD"); @@ -722,7 +723,7 @@ void HashGridsFromNegativeXArtifactsTest(Raytracer::Algorithm raytracingAlgorith WALBERLA_LOG_INFO_ON_ROOT(" Generating " << boxes << " boxes"); shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr<BlockForest> forest = createBlockForest(AABB(0,0,0,4,4,4), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); + auto forest = blockforest::createBlockForest(AABB(0,0,0,4,4,4), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); auto ccdID = forest->addBlockData(ccd::createHashGridsDataHandling(globalBodyStorage, storageID), "CCD"); @@ -768,7 +769,7 @@ void HashGridsTestScene(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RA WALBERLA_LOG_INFO_ON_ROOT("HashGrids Test Scene"); shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr<BlockForest> forest = createBlockForest(AABB(0,0,0,8,8,8), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); + auto forest = blockforest::createBlockForest(AABB(0,0,0,8,8,8), Vector3<uint_t>(1,1,1), Vector3<bool>(false, false, false)); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); auto ccdID = forest->addBlockData(ccd::createHashGridsDataHandling(globalBodyStorage, storageID), "CCD"); diff --git a/tests/pe/RefinementWithSpareProcesses.cpp b/tests/pe/RefinementWithSpareProcesses.cpp index 1690d368f2dfcc8be29e2013c503d095a17afdb4..9a6b93462a6cab6feeb13bdd0b4c1b6e4299aeae 100644 --- a/tests/pe/RefinementWithSpareProcesses.cpp +++ b/tests/pe/RefinementWithSpareProcesses.cpp @@ -19,7 +19,7 @@ //====================================================================================================================== -#include "blockforest/BlockForest.h" +#include "blockforest/Initialization.h" #include "blockforest/loadbalancing/DynamicCurve.h" #include "blockforest/loadbalancing/DynamicDiffusive.h" #include "blockforest/loadbalancing/DynamicParMetis.h" @@ -57,10 +57,9 @@ int main( int /*argc*/, char ** /*argv*/, const std::string& LBAlgorithm ) shared_ptr<BodyStorage> globalStorage = make_shared<BodyStorage>(); // create forest - auto blockforest = createBlockForest( - math::AABB(0,0,0,10,10,10), - Vector3<uint_t>(2,2,2), - Vector3<bool>(false, false, false) ); + auto blockforest = blockforest::createBlockForest( math::AABB(0,0,0,10,10,10), + Vector3<uint_t>(2,2,2), + Vector3<bool>(false, false, false) ); SetBodyTypeIDs<BodyTuple>::execute(); diff --git a/tests/pe/SerializeDeserialize.cpp b/tests/pe/SerializeDeserialize.cpp index 9d92831a20d50d36b370f671a91946bc8029ecb2..4a6267aa779522d08564a86a51376d92d43afaea 100644 --- a/tests/pe/SerializeDeserialize.cpp +++ b/tests/pe/SerializeDeserialize.cpp @@ -19,9 +19,9 @@ //====================================================================================================================== -#include "blockforest/all.h" -#include "core/all.h" -#include "domain_decomposition/all.h" +#include "blockforest/Initialization.h" +#include "core/Environment.h" +#include "core/debug/TestSubsystem.h" #include "pe/basic.h" #include "pe/communication/ParseMessage.h" @@ -47,9 +47,9 @@ void createDump() // create blocks //! [Dump Blockforest] - auto forest = createBlockForest( math::AABB(0,0,0,60,60,60), - Vector3<uint_t>(2,2,2), // number of blocks - Vector3<bool>(false, false, false)); // periodicity + auto forest = blockforest::createBlockForest( math::AABB(0,0,0,60,60,60), + Vector3<uint_t>(2,2,2), // number of blocks + Vector3<bool>(false, false, false)); // periodicity forest->saveToFile("SerializeDeserialize.sbf"); //! [Dump Blockforest] @@ -150,4 +150,4 @@ int main( int argc, char ** argv ) int main( int argc, char* argv[] ) { return walberla::main( argc, argv ); -} \ No newline at end of file +}