From 205c8340cc6800c0d462a9888cecfac4be3b94d0 Mon Sep 17 00:00:00 2001
From: Pedro Gonnet <gonnet@google.com>
Date: Tue, 26 Jul 2016 21:21:12 +0200
Subject: [PATCH] only collect h_max from local cells.

---
 src/space.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/space.c b/src/space.c
index 04271ca367..ab47a4965e 100644
--- a/src/space.c
+++ b/src/space.c
@@ -168,7 +168,9 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
   if (nr_parts > 0) {
     if (s->cells != NULL) {
       for (int k = 0; k < s->nr_cells; k++) {
-        if (s->cells[k].h_max > h_max) h_max = s->cells[k].h_max;
+        if (s->cells[k].nodeID == engine_rank && s->cells[k].h_max > h_max) {
+          h_max = s->cells[k].h_max;
+        }
       }
     } else {
       for (size_t k = 0; k < nr_parts; k++) {
-- 
GitLab