From 04028ce377621f4147e14118f29c5706cb9182ab Mon Sep 17 00:00:00 2001
From: Rafael Ravedutti <rafaelravedutti@gmail.com>
Date: Sun, 10 Mar 2024 22:32:26 +0100
Subject: [PATCH] Initialize tree weights and neighborhood

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
---
 runtime/domain/block_forest.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/runtime/domain/block_forest.cpp b/runtime/domain/block_forest.cpp
index 92555fa..8b8d5b5 100644
--- a/runtime/domain/block_forest.cpp
+++ b/runtime/domain/block_forest.cpp
@@ -217,9 +217,9 @@ void BlockForest::rebalance() {
         forest->refresh();
     }
 
-    this->setBoundingBox();
     this->updateWeights();
     this->updateNeighborhood();
+    this->setBoundingBox();
 }
 
 void BlockForest::initialize(int *argc, char ***argv) {
@@ -244,11 +244,16 @@ void BlockForest::initialize(int *argc, char ***argv) {
         domain, block_config, walberla::Vector3<bool>(true, true, true), procs, ref_level);
 
     this->info = make_shared<walberla::blockforest::InfoCollection>();
-    this->setBoundingBox();
 
     if(balance_workload) {
         this->initializeWorkloadBalancer();
+        this->updateWeights();
+        forest->refresh();
     }
+
+    this->updateWeights();
+    this->updateNeighborhood();
+    this->setBoundingBox();
 }
 
 void BlockForest::initializeWorkloadBalancer() {
-- 
GitLab