Skip to content
Snippets Groups Projects
Commit 8557c6af authored by Christoph Rettinger's avatar Christoph Rettinger
Browse files

Refactored pe and mesapd load balancing to avoid interdependency

parent c314adcb
No related merge requests found
Showing
with 118 additions and 121 deletions
......@@ -15,11 +15,11 @@ waLBerla_add_executable ( NAME MESA_PD_LoadBalancing
waLBerla_add_executable ( NAME MESA_PD_GranularGas
FILES MESA_PD_GranularGas.cpp SQLProperties.cpp Parameters.cpp NodeTimings.cpp sortParticleStorage.cpp CreateParticles.cpp
DEPENDS blockforest core pe mesa_pd postprocessing sqlite vtk )
DEPENDS blockforest core mesa_pd postprocessing sqlite vtk )
waLBerla_add_executable ( NAME MESA_PD_KernelBenchmark
FILES MESA_PD_KernelBenchmark.cpp SQLProperties.cpp Parameters.cpp NodeTimings.cpp sortParticleStorage.cpp CreateParticles.cpp
DEPENDS blockforest core pe mesa_pd postprocessing sqlite vtk )
DEPENDS blockforest core mesa_pd postprocessing sqlite vtk )
waLBerla_add_executable ( NAME MESA_PD_KernelLoadBalancing
FILES MESA_PD_KernelLoadBalancing.cpp SQLProperties.cpp Parameters.cpp NodeTimings.cpp sortParticleStorage.cpp CreateParticles.cpp
......
......@@ -59,6 +59,9 @@
#include <blockforest/loadbalancing/DynamicParMetis.h>
#include <blockforest/loadbalancing/InfoCollection.h>
#include <blockforest/loadbalancing/PODPhantomData.h>
#include <blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h>
#include <blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h>
#include <blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h>
#include <core/Abort.h>
#include <core/Environment.h>
#include <core/Hostname.h>
......@@ -73,9 +76,6 @@
#include <core/timing/Timer.h>
#include <core/timing/TimingPool.h>
#include <core/waLBerlaBuildInfo.h>
#include <pe/amr/level_determination/MinMaxLevelDetermination.h>
#include <pe/amr/weight_assignment/MetisAssignmentFunctor.h>
#include <pe/amr/weight_assignment/WeightAssignmentFunctor.h>
#include <sqlite/SQLite.h>
#include <vtk/VTKOutput.h>
......@@ -136,7 +136,7 @@ int main( int argc, char ** argv )
auto ic = make_shared<blockforest::InfoCollection>();
pe::amr::MinMaxLevelDetermination regrid(ic, params.regridMin, params.regridMax);
blockforest::MinMaxLevelDetermination regrid(ic, params.regridMin, params.regridMax);
forest->setRefreshMinTargetLevelDeterminationFunction( regrid );
bool bRebalance = true;
......@@ -145,28 +145,28 @@ int main( int argc, char ** argv )
bRebalance = false;
} else if (params.LBAlgorithm == "Morton")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicCurveBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false );
auto prepFunc = blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false );
prepFunc.setMaxBlocksPerProcess( params.maxBlocksPerProcess );
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Hilbert")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicCurveBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, false );
auto prepFunc = blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, false );
prepFunc.setMaxBlocksPerProcess( params.maxBlocksPerProcess );
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Metis")
{
auto assFunc = pe::amr::MetisAssignmentFunctor( ic, params.baseWeight );
auto assFunc = blockforest::MetisAssignmentFunctor( ic, params.baseWeight );
forest->setRefreshPhantomBlockDataAssignmentFunction( assFunc );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto alg = blockforest::DynamicParMetis::stringToAlgorithm( params.metisAlgorithm );
auto vWeight = blockforest::DynamicParMetis::stringToWeightsToUse( params.metisWeightsToUse );
......@@ -178,10 +178,10 @@ int main( int argc, char ** argv )
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Diffusive")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicDiffusionBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( 1, 1, false );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicDiffusionBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( 1, 1, false );
//configure(cfg, prepFunc);
//addDynamicDiffusivePropertiesToSQL(prepFunc, integerProperties, realProperties, stringProperties);
forest->setRefreshPhantomBlockMigrationPreparationFunction(prepFunc);
......
......@@ -57,6 +57,9 @@
#include <blockforest/loadbalancing/DynamicParMetis.h>
#include <blockforest/loadbalancing/InfoCollection.h>
#include <blockforest/loadbalancing/PODPhantomData.h>
#include <blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h>
#include <blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h>
#include <blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h>
#include <core/Abort.h>
#include <core/Environment.h>
#include <core/math/Random.h>
......@@ -67,9 +70,6 @@
#include <core/OpenMP.h>
#include <core/timing/Timer.h>
#include <core/waLBerlaBuildInfo.h>
#include <pe/amr/level_determination/MinMaxLevelDetermination.h>
#include <pe/amr/weight_assignment/MetisAssignmentFunctor.h>
#include <pe/amr/weight_assignment/WeightAssignmentFunctor.h>
#include <sqlite/SQLite.h>
#include <vtk/VTKOutput.h>
......@@ -174,7 +174,7 @@ int main( int argc, char ** argv )
auto ic = make_shared<blockforest::InfoCollection>();
pe::amr::MinMaxLevelDetermination regrid(ic, params.regridMin, params.regridMax);
blockforest::MinMaxLevelDetermination regrid(ic, params.regridMin, params.regridMax);
forest->setRefreshMinTargetLevelDeterminationFunction( regrid );
bool bRebalance = true;
......@@ -183,28 +183,28 @@ int main( int argc, char ** argv )
bRebalance = false;
} else if (params.LBAlgorithm == "Morton")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicCurveBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false );
auto prepFunc = blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false );
prepFunc.setMaxBlocksPerProcess( params.maxBlocksPerProcess );
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Hilbert")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicCurveBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, false );
auto prepFunc = blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, false );
prepFunc.setMaxBlocksPerProcess( params.maxBlocksPerProcess );
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Metis")
{
auto assFunc = pe::amr::MetisAssignmentFunctor( ic, params.baseWeight );
auto assFunc = blockforest::MetisAssignmentFunctor( ic, params.baseWeight );
forest->setRefreshPhantomBlockDataAssignmentFunction( assFunc );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto alg = blockforest::DynamicParMetis::stringToAlgorithm( params.metisAlgorithm );
auto vWeight = blockforest::DynamicParMetis::stringToWeightsToUse( params.metisWeightsToUse );
......@@ -216,10 +216,10 @@ int main( int argc, char ** argv )
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Diffusive")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicDiffusionBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( 1, 1, false );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicDiffusionBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( 1, 1, false );
configure(mainConf, prepFunc);
addDynamicDiffusivePropertiesToSQL(prepFunc, integerProperties, realProperties, stringProperties);
forest->setRefreshPhantomBlockMigrationPreparationFunction(prepFunc);
......
......@@ -23,9 +23,6 @@
#include "SQLProperties.h"
#include <pe/amr/InfoCollection.h>
#include <pe/amr/level_determination/MinMaxLevelDetermination.h>
#include <pe/amr/weight_assignment/MetisAssignmentFunctor.h>
#include <pe/amr/weight_assignment/WeightAssignmentFunctor.h>
#include <pe/basic.h>
#include <pe/synchronization/ClearSynchronization.h>
#include <pe/vtk/SphereVtkOutput.h>
......@@ -34,6 +31,9 @@
#include <blockforest/loadbalancing/DynamicCurve.h>
#include <blockforest/loadbalancing/DynamicParMetis.h>
#include <blockforest/loadbalancing/PODPhantomData.h>
#include <blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h>
#include <blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h>
#include <blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h>
#include <core/Abort.h>
#include <core/Environment.h>
#include <core/math/Random.h>
......@@ -132,7 +132,7 @@ int main( int argc, char ** argv )
auto ic = make_shared<blockforest::InfoCollection>();
pe::amr::MinMaxLevelDetermination regrid(ic, params.regridMin, params.regridMax);
blockforest::MinMaxLevelDetermination regrid(ic, params.regridMin, params.regridMax);
forest->setRefreshMinTargetLevelDeterminationFunction( regrid );
bool bRebalance = true;
......@@ -141,28 +141,28 @@ int main( int argc, char ** argv )
bRebalance = false;
} else if (params.LBAlgorithm == "Morton")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicCurveBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false );
auto prepFunc = blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false );
prepFunc.setMaxBlocksPerProcess( params.maxBlocksPerProcess );
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Hilbert")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicCurveBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, false );
auto prepFunc = blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, false );
prepFunc.setMaxBlocksPerProcess( params.maxBlocksPerProcess );
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Metis")
{
auto assFunc = pe::amr::MetisAssignmentFunctor( ic, params.baseWeight );
auto assFunc = blockforest::MetisAssignmentFunctor( ic, params.baseWeight );
forest->setRefreshPhantomBlockDataAssignmentFunction( assFunc );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto alg = blockforest::DynamicParMetis::stringToAlgorithm( params.metisAlgorithm );
auto vWeight = blockforest::DynamicParMetis::stringToWeightsToUse( params.metisWeightsToUse );
......@@ -174,10 +174,10 @@ int main( int argc, char ** argv )
forest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (params.LBAlgorithm == "Diffusive")
{
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicDiffusionBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( 1, 1, false );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, params.baseWeight ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicDiffusionBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( 1, 1, false );
//configure(cfg, prepFunc);
//addDynamicDiffusivePropertiesToSQL(prepFunc, integerProperties, realProperties, stringProperties);
forest->setRefreshPhantomBlockMigrationPreparationFunction(prepFunc);
......
......@@ -14,4 +14,8 @@ target_sources( blockforest
DynamicParMetis.cpp
StaticCurve.cpp
StaticParMetis.cpp
)
\ No newline at end of file
)
add_subdirectory( weight_assignment )
add_subdirectory( level_determination )
\ No newline at end of file
target_sources( pe
target_sources( blockforest
PRIVATE
MinMaxLevelDetermination.h
MinMaxLevelDetermination.cpp
......
......@@ -20,9 +20,10 @@
#include "MinMaxLevelDetermination.h"
#include "core/logging/Logging.h"
namespace walberla {
namespace pe {
namespace amr {
namespace blockforest {
void MinMaxLevelDetermination::operator()( std::vector< std::pair< const Block *, uint_t > > & minTargetLevels,
std::vector< const Block * > &,
......@@ -81,6 +82,5 @@ blockforest::InfoCollection::const_iterator MinMaxLevelDetermination::getOrCreat
return ic_->insert( std::make_pair(fatherId, newWeight) ).first;
}
} // namespace amr
} // namespace pe
} // namespace blockforest
} // namespace walberla
......@@ -20,17 +20,14 @@
#pragma once
#include <pe/Types.h>
#include <pe/amr/InfoCollection.h>
#include "blockforest/Block.h"
#include "blockforest/BlockForest.h"
#include "blockforest/loadbalancing/InfoCollection.h"
#include <blockforest/Block.h>
#include <blockforest/BlockForest.h>
#include <core/logging/Logging.h>
#include <domain_decomposition/BlockDataID.h>
#include <vector>
namespace walberla {
namespace pe {
namespace amr {
namespace blockforest {
class MinMaxLevelDetermination
{
......@@ -54,6 +51,5 @@ public:
blockforest::InfoCollection::const_iterator getOrCreateCoarseInfo( const blockforest::BlockID& id );
};
} // namespace amr
} // namespace pe
} // namespace blockforest
} // namespace walberla
target_sources( pe
target_sources( blockforest
PRIVATE
WeightAssignmentFunctor.h
MetisAssignmentFunctor.h
......
......@@ -27,8 +27,7 @@
#include "domain_decomposition/PeriodicIntersectionVolume.h"
namespace walberla {
namespace pe {
namespace amr {
namespace blockforest {
/**
* Assignment functor for ParMetis based load balancing.
......@@ -95,5 +94,4 @@ private:
}
}
}
......@@ -26,8 +26,7 @@
#include "blockforest/PhantomBlockForest.h"
namespace walberla {
namespace pe {
namespace amr {
namespace blockforest {
/**
* General assignment functor for load balancing.
......@@ -70,4 +69,3 @@ private:
}
}
}
......@@ -2,6 +2,4 @@ target_sources( pe
PRIVATE
InfoCollection.cpp
InfoCollection.h
)
add_subdirectory( level_determination )
add_subdirectory( weight_assignment )
\ No newline at end of file
)
\ No newline at end of file
......@@ -27,10 +27,10 @@
#include <blockforest/Initialization.h>
#include <blockforest/loadbalancing/DynamicCurve.h>
#include <blockforest/loadbalancing/InfoCollection.h>
#include <blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h>
#include <blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h>
#include <core/debug/TestSubsystem.h>
#include <core/logging/Logging.h>
#include <pe/amr/level_determination/MinMaxLevelDetermination.h>
#include <pe/amr/weight_assignment/WeightAssignmentFunctor.h>
namespace walberla {
......@@ -101,14 +101,14 @@ int main( bool simple )
blockforest::DynamicCurveBalance< blockforest::NoPhantomData >( false, true, false ) );
} else
{
forest->setRefreshMinTargetLevelDeterminationFunction( pe::amr::MinMaxLevelDetermination(infoCollection, 2, 5) );
forest->setRefreshMinTargetLevelDeterminationFunction( blockforest::MinMaxLevelDetermination(infoCollection, 2, 5) );
forest->setRefreshPhantomBlockDataAssignmentFunction( pe::amr::WeightAssignmentFunctor( infoCollection ) );
forest->setRefreshPhantomBlockDataPackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( pe::amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( infoCollection ) );
forest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
forest->setRefreshPhantomBlockMigrationPreparationFunction(
blockforest::DynamicCurveBalance< pe::amr::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false ) );
blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false ) );
}
auto ps = std::make_shared<data::ParticleStorage> (100);
......@@ -138,7 +138,7 @@ int main( bool simple )
if (!simple)
{
forest->setRefreshMinTargetLevelDeterminationFunction( pe::amr::MinMaxLevelDetermination(infoCollection, 2, 9) );
forest->setRefreshMinTargetLevelDeterminationFunction( blockforest::MinMaxLevelDetermination(infoCollection, 2, 9) );
}
domain::createWithNeighborhood(ac, *forest, *infoCollection);
forest->refresh();
......
......@@ -22,6 +22,9 @@
#include "blockforest/all.h"
#include "blockforest/loadbalancing/InfoCollection.h"
#include <blockforest/loadbalancing/PODPhantomData.h>
#include <blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h>
#include <blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h>
#include <blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h>
#include "core/all.h"
#include "domain_decomposition/all.h"
#include "timeloop/SweepTimeloop.h"
......@@ -29,8 +32,7 @@
#include "pe/basic.h"
#include "pe/amr/level_determination/MinMaxLevelDetermination.h"
#include "pe/amr/weight_assignment/WeightAssignmentFunctor.h"
#include "pe/amr/InfoCollection.h"
#include "pe/ccd/SimpleCCDDataHandling.h"
#include "pe/synchronization/SyncNextNeighbors.h"
#include "pe/synchronization/ClearSynchronization.h"
......@@ -97,15 +99,15 @@ int main( int argc, char ** argv )
auto infoCollection = make_shared<blockforest::InfoCollection>();
amr::MinMaxLevelDetermination levelDetermination(infoCollection, 2, 5);
blockforest::MinMaxLevelDetermination levelDetermination(infoCollection, 2, 5);
blockforest.setRefreshMinTargetLevelDeterminationFunction( levelDetermination );
blockforest.setRefreshPhantomBlockDataAssignmentFunction( amr::WeightAssignmentFunctor( infoCollection ) );
blockforest.setRefreshPhantomBlockDataPackFunction( amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest.setRefreshPhantomBlockDataUnpackFunction( amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest.setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( infoCollection ) );
blockforest.setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest.setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest.setRefreshPhantomBlockMigrationPreparationFunction(
blockforest::DynamicCurveBalance< amr::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false ) );
blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false ) );
createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(1,1,1), 1);
createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(1,1,3), 1);
......@@ -133,7 +135,7 @@ int main( int argc, char ** argv )
WALBERLA_MPI_BARRIER();
WALBERLA_LOG_DEVEL_ON_ROOT( "Refinement 2" );
blockforest.setRefreshMinTargetLevelDeterminationFunction( amr::MinMaxLevelDetermination(infoCollection, 9, 20) );
blockforest.setRefreshMinTargetLevelDeterminationFunction( blockforest::MinMaxLevelDetermination(infoCollection, 9, 20) );
createWithNeighborhoodLocalShadow(blockforest, storageID, *infoCollection);
clearSynchronization( blockforest, storageID);
forest->refresh();
......@@ -155,7 +157,7 @@ int main( int argc, char ** argv )
WALBERLA_MPI_BARRIER();
WALBERLA_LOG_DEVEL_ON_ROOT( "Refinement 3" );
blockforest.setRefreshMinTargetLevelDeterminationFunction( amr::MinMaxLevelDetermination(infoCollection, 2, 3) );
blockforest.setRefreshMinTargetLevelDeterminationFunction( blockforest::MinMaxLevelDetermination(infoCollection, 2, 3) );
createWithNeighborhoodLocalShadow(blockforest, storageID, *infoCollection);
clearSynchronization( blockforest, storageID);
forest->refresh();
......
......@@ -25,12 +25,13 @@
#include "blockforest/loadbalancing/DynamicParMetis.h"
#include "blockforest/loadbalancing/InfoCollection.h"
#include "blockforest/loadbalancing/PODPhantomData.h"
#include "blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h"
#include "blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h"
#include "blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h"
#include "pe/basic.h"
#include "pe/amr/level_determination/MinMaxLevelDetermination.h"
#include "pe/amr/weight_assignment/MetisAssignmentFunctor.h"
#include "pe/amr/weight_assignment/WeightAssignmentFunctor.h"
#include "pe/ccd/SimpleCCDDataHandling.h"
#include "pe/amr/InfoCollection.h"
#include "core/debug/TestSubsystem.h"
#include "core/grid_generator/SCIterator.h"
......@@ -79,30 +80,30 @@ int main( int /*argc*/, char ** /*argv*/, const std::string& LBAlgorithm )
auto ic = make_shared<blockforest::InfoCollection>();
blockforest->setRefreshMinTargetLevelDeterminationFunction( amr::MinMaxLevelDetermination(ic, 50, 100) );
blockforest->setRefreshMinTargetLevelDeterminationFunction( blockforest::MinMaxLevelDetermination(ic, 50, 100) );
if (LBAlgorithm == "Morton")
{
blockforest->setRefreshPhantomBlockDataAssignmentFunction( amr::WeightAssignmentFunctor( ic, real_t(1) ) );
blockforest->setRefreshPhantomBlockDataPackFunction( amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataUnpackFunction( amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, real_t(1) ) );
blockforest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicCurveBalance< amr::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false );
auto prepFunc = blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false );
blockforest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (LBAlgorithm == "Hilbert")
{
blockforest->setRefreshPhantomBlockDataAssignmentFunction( amr::WeightAssignmentFunctor( ic, real_t(1) ) );
blockforest->setRefreshPhantomBlockDataPackFunction( amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataUnpackFunction( amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, real_t(1) ) );
blockforest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicCurveBalance< amr::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, false );
auto prepFunc = blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, false );
blockforest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (LBAlgorithm == "Metis")
{
auto assFunc = amr::MetisAssignmentFunctor( ic, real_t(1) );
auto assFunc = blockforest::MetisAssignmentFunctor( ic, real_t(1) );
blockforest->setRefreshPhantomBlockDataAssignmentFunction( assFunc );
blockforest->setRefreshPhantomBlockDataPackFunction( amr::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataUnpackFunction( amr::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataPackFunction( blockforest::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataUnpackFunction( blockforest::MetisAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto alg = blockforest::DynamicParMetis::stringToAlgorithm( "PART_GEOM_KWAY" );
auto vWeight = blockforest::DynamicParMetis::stringToWeightsToUse( "VERTEX_WEIGHTS" );
......@@ -113,10 +114,10 @@ int main( int /*argc*/, char ** /*argv*/, const std::string& LBAlgorithm )
blockforest->setRefreshPhantomBlockMigrationPreparationFunction( prepFunc );
} else if (LBAlgorithm == "Diffusive")
{
blockforest->setRefreshPhantomBlockDataAssignmentFunction( amr::WeightAssignmentFunctor( ic, real_t(1) ) );
blockforest->setRefreshPhantomBlockDataPackFunction( amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataUnpackFunction( amr::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicDiffusionBalance< amr::WeightAssignmentFunctor::PhantomBlockWeight >( 20, 12, false );
blockforest->setRefreshPhantomBlockDataAssignmentFunction( blockforest::WeightAssignmentFunctor( ic, real_t(1) ) );
blockforest->setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
blockforest->setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
auto prepFunc = blockforest::DynamicDiffusionBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( 20, 12, false );
prepFunc.adaptInflowWithGlobalInformation( true );
prepFunc.adaptOutflowWithGlobalInformation( true );
blockforest->setRefreshPhantomBlockMigrationPreparationFunction(prepFunc);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment