From 50c8dceedef146510197fc9db30af1d2acdd05a7 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Sun, 5 Aug 2018 15:41:17 +0100
Subject: [PATCH] When running gravity+hydro only consider gparts for the cell
 splitting.

---
 src/space.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/space.c b/src/space.c
index f2a6dd1f52..5210ff68a7 100644
--- a/src/space.c
+++ b/src/space.c
@@ -1731,6 +1731,7 @@ void space_split_recursive(struct space *s, struct cell *c,
   const int count = c->count;
   const int gcount = c->gcount;
   const int scount = c->scount;
+  const int with_gravity = s->gravity;
   const int depth = c->depth;
   int maxdepth = 0;
   float h_max = 0.0f;
@@ -1792,8 +1793,8 @@ void space_split_recursive(struct space *s, struct cell *c,
   }
 
   /* Split or let it be? */
-  if (count > space_splitsize || gcount > space_splitsize ||
-      scount > space_splitsize) {
+  if ((with_gravity && gcount > space_splitsize) ||
+      (!with_gravity && (count > space_splitsize || scount > space_splitsize))) {
 
     /* No longer just a leaf. */
     c->split = 1;
-- 
GitLab