diff --git a/src/engine.c b/src/engine.c index 37124546b5698de7c311e97b902540ca15588b21..8a99358d2cbeab62c76d4b6aa78236431d9a0c81 100644 --- a/src/engine.c +++ b/src/engine.c @@ -358,10 +358,8 @@ void engine_make_hierarchical_tasks_gravity(struct engine *e, struct cell *c) { } } - /* We are below the super-cell */ - else if (c->super_gravity != NULL) { - - // MATTHIEU stop the recursion below the level where there are tasks + /* We are below the super-cell but not below the maximal splitting depth */ + else if (c->super_gravity != NULL && c->depth <= space_subdepth_grav) { /* Local tasks only... */ if (c->nodeID == e->nodeID) { @@ -380,8 +378,8 @@ void engine_make_hierarchical_tasks_gravity(struct engine *e, struct cell *c) { } } - /* Recurse. */ - if (c->split) + /* Recurse but not below the maximal splitting depth */ + if (c->split && c->depth <= space_subdepth_grav) for (int k = 0; k < 8; k++) if (c->progeny[k] != NULL) engine_make_hierarchical_tasks_gravity(e, c->progeny[k]);