From 6dbca4000e3428681a74fa24d32d4f49c6545edc Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Tue, 6 Nov 2018 12:44:07 +0000
Subject: [PATCH] Communicate the maximal depth of the tree when exchanging
 cells at rebuild time.

---
 src/cell.c | 3 +++
 src/cell.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/cell.c b/src/cell.c
index b869803f15..79ccf02118 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -190,6 +190,7 @@ int cell_pack(struct cell *restrict c, struct pcell *restrict pc,
   pc->hydro.count = c->hydro.count;
   pc->grav.count = c->grav.count;
   pc->stars.count = c->stars.count;
+  pc->maxdepth = c->maxdepth;
 
   /* Copy the Multipole related information */
   if (with_gravity) {
@@ -292,6 +293,8 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
   c->hydro.count = pc->hydro.count;
   c->grav.count = pc->grav.count;
   c->stars.count = pc->stars.count;
+  c->maxdepth = pc->maxdepth;
+
 #ifdef SWIFT_DEBUG_CHECKS
   c->cellID = pc->cellID;
 #endif
diff --git a/src/cell.h b/src/cell.h
index 575b764b9b..a5d0f7c61d 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -149,6 +149,9 @@ struct pcell {
 
   } stars;
 
+  /*! Maximal depth in that part of the tree */
+  int maxdepth;
+
   /*! Relative indices of the cell's progeny. */
   int progeny[8];
 
-- 
GitLab