From 8557c6afa80a27de1990d88a2aa8c6391b1a8bce Mon Sep 17 00:00:00 2001
From: Christoph Rettinger <christoph.rettinger@fau.de>
Date: Mon, 9 May 2022 15:38:32 +0200
Subject: [PATCH] Refactored pe and mesapd load balancing to avoid
 interdependency

---
 apps/benchmarks/GranularGas/CMakeLists.txt    |  4 +-
 .../MESA_PD_KernelLoadBalancing.cpp           | 38 +++++++++---------
 .../GranularGas/MESA_PD_LoadBalancing.cpp     | 38 +++++++++---------
 .../GranularGas/PE_LoadBalancing.cpp          | 38 +++++++++---------
 src/blockforest/loadbalancing/CMakeLists.txt  |  6 ++-
 .../level_determination/CMakeLists.txt        |  2 +-
 .../MinMaxLevelDetermination.cpp              |  8 ++--
 .../MinMaxLevelDetermination.h                | 16 +++-----
 .../weight_assignment/CMakeLists.txt          |  2 +-
 .../MetisAssignmentFunctor.h                  |  4 +-
 .../WeightAssignmentFunctor.h                 |  4 +-
 src/pe/amr/CMakeLists.txt                     |  4 +-
 tests/mesa_pd/domain/DynamicRefinement.cpp    | 16 ++++----
 tests/pe/MinMaxRefinement.cpp                 | 20 +++++-----
 tests/pe/RefinementWithSpareProcesses.cpp     | 39 ++++++++++---------
 15 files changed, 118 insertions(+), 121 deletions(-)
 rename src/{pe/amr => blockforest/loadbalancing}/level_determination/CMakeLists.txt (75%)
 rename src/{pe/amr => blockforest/loadbalancing}/level_determination/MinMaxLevelDetermination.cpp (97%)
 rename src/{pe/amr => blockforest/loadbalancing}/level_determination/MinMaxLevelDetermination.h (86%)
 rename src/{pe/amr => blockforest/loadbalancing}/weight_assignment/CMakeLists.txt (74%)
 rename src/{pe/amr => blockforest/loadbalancing}/weight_assignment/MetisAssignmentFunctor.h (99%)
 rename src/{pe/amr => blockforest/loadbalancing}/weight_assignment/WeightAssignmentFunctor.h (98%)

diff --git a/apps/benchmarks/GranularGas/CMakeLists.txt b/apps/benchmarks/GranularGas/CMakeLists.txt
index b017add69..f54ca9096 100644
--- a/apps/benchmarks/GranularGas/CMakeLists.txt
+++ b/apps/benchmarks/GranularGas/CMakeLists.txt
@@ -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
diff --git a/apps/benchmarks/GranularGas/MESA_PD_KernelLoadBalancing.cpp b/apps/benchmarks/GranularGas/MESA_PD_KernelLoadBalancing.cpp
index 176388493..c3640e9f0 100644
--- a/apps/benchmarks/GranularGas/MESA_PD_KernelLoadBalancing.cpp
+++ b/apps/benchmarks/GranularGas/MESA_PD_KernelLoadBalancing.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);
diff --git a/apps/benchmarks/GranularGas/MESA_PD_LoadBalancing.cpp b/apps/benchmarks/GranularGas/MESA_PD_LoadBalancing.cpp
index b8360a14f..e7de4a209 100644
--- a/apps/benchmarks/GranularGas/MESA_PD_LoadBalancing.cpp
+++ b/apps/benchmarks/GranularGas/MESA_PD_LoadBalancing.cpp
@@ -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);
diff --git a/apps/benchmarks/GranularGas/PE_LoadBalancing.cpp b/apps/benchmarks/GranularGas/PE_LoadBalancing.cpp
index 511624fde..ecfd51e28 100644
--- a/apps/benchmarks/GranularGas/PE_LoadBalancing.cpp
+++ b/apps/benchmarks/GranularGas/PE_LoadBalancing.cpp
@@ -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);
diff --git a/src/blockforest/loadbalancing/CMakeLists.txt b/src/blockforest/loadbalancing/CMakeLists.txt
index ba4d7c697..a40165a2e 100644
--- a/src/blockforest/loadbalancing/CMakeLists.txt
+++ b/src/blockforest/loadbalancing/CMakeLists.txt
@@ -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
diff --git a/src/pe/amr/level_determination/CMakeLists.txt b/src/blockforest/loadbalancing/level_determination/CMakeLists.txt
similarity index 75%
rename from src/pe/amr/level_determination/CMakeLists.txt
rename to src/blockforest/loadbalancing/level_determination/CMakeLists.txt
index 3124c8f8a..34358b29d 100644
--- a/src/pe/amr/level_determination/CMakeLists.txt
+++ b/src/blockforest/loadbalancing/level_determination/CMakeLists.txt
@@ -1,4 +1,4 @@
-target_sources( pe
+target_sources( blockforest
     PRIVATE
     MinMaxLevelDetermination.h
     MinMaxLevelDetermination.cpp     
diff --git a/src/pe/amr/level_determination/MinMaxLevelDetermination.cpp b/src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.cpp
similarity index 97%
rename from src/pe/amr/level_determination/MinMaxLevelDetermination.cpp
rename to src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.cpp
index 93f0b31c0..f301fb844 100644
--- a/src/pe/amr/level_determination/MinMaxLevelDetermination.cpp
+++ b/src/blockforest/loadbalancing/level_determination/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
diff --git a/src/pe/amr/level_determination/MinMaxLevelDetermination.h b/src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h
similarity index 86%
rename from src/pe/amr/level_determination/MinMaxLevelDetermination.h
rename to src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h
index a5b91e62e..1e8902240 100644
--- a/src/pe/amr/level_determination/MinMaxLevelDetermination.h
+++ b/src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.h
@@ -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
diff --git a/src/pe/amr/weight_assignment/CMakeLists.txt b/src/blockforest/loadbalancing/weight_assignment/CMakeLists.txt
similarity index 74%
rename from src/pe/amr/weight_assignment/CMakeLists.txt
rename to src/blockforest/loadbalancing/weight_assignment/CMakeLists.txt
index 7fdd4999b..fd84f74ce 100644
--- a/src/pe/amr/weight_assignment/CMakeLists.txt
+++ b/src/blockforest/loadbalancing/weight_assignment/CMakeLists.txt
@@ -1,4 +1,4 @@
-target_sources( pe
+target_sources( blockforest
     PRIVATE
     WeightAssignmentFunctor.h
     MetisAssignmentFunctor.h     
diff --git a/src/pe/amr/weight_assignment/MetisAssignmentFunctor.h b/src/blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h
similarity index 99%
rename from src/pe/amr/weight_assignment/MetisAssignmentFunctor.h
rename to src/blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h
index e16d67540..6e4d062a8 100644
--- a/src/pe/amr/weight_assignment/MetisAssignmentFunctor.h
+++ b/src/blockforest/loadbalancing/weight_assignment/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:
 
 }
 }
-}
 
diff --git a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h b/src/blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h
similarity index 98%
rename from src/pe/amr/weight_assignment/WeightAssignmentFunctor.h
rename to src/blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h
index e6373152a..2fdec3bed 100644
--- a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h
+++ b/src/blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h
@@ -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:
 
 }
 }
-}
diff --git a/src/pe/amr/CMakeLists.txt b/src/pe/amr/CMakeLists.txt
index b5df7ae32..c5643990d 100644
--- a/src/pe/amr/CMakeLists.txt
+++ b/src/pe/amr/CMakeLists.txt
@@ -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
diff --git a/tests/mesa_pd/domain/DynamicRefinement.cpp b/tests/mesa_pd/domain/DynamicRefinement.cpp
index 5f1f83ef7..1e1b6a9b9 100644
--- a/tests/mesa_pd/domain/DynamicRefinement.cpp
+++ b/tests/mesa_pd/domain/DynamicRefinement.cpp
@@ -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();
diff --git a/tests/pe/MinMaxRefinement.cpp b/tests/pe/MinMaxRefinement.cpp
index 1e47e2e1e..6cd56cb09 100644
--- a/tests/pe/MinMaxRefinement.cpp
+++ b/tests/pe/MinMaxRefinement.cpp
@@ -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();
diff --git a/tests/pe/RefinementWithSpareProcesses.cpp b/tests/pe/RefinementWithSpareProcesses.cpp
index ef31e726c..946f9c3f9 100644
--- a/tests/pe/RefinementWithSpareProcesses.cpp
+++ b/tests/pe/RefinementWithSpareProcesses.cpp
@@ -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);
-- 
GitLab