diff --git a/src/active.h b/src/active.h index 3fe52a86b373ff0b33b88eca0dac9b7c6b58a216..d53c2fcce750e4ea2d9b280cc968f0dc1dd04304 100644 --- a/src/active.h +++ b/src/active.h @@ -129,7 +129,7 @@ __attribute__((always_inline)) INLINE static int cell_is_active_gravity( const struct cell *c, const struct engine *e) { #ifdef SWIFT_DEBUG_CHECKS - if (c->ti_gravity_end_min < e->ti_current) + if (c->ti_gravity_end_min < e->ti_current && c->nr_tasks > 0) error( "cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and " "e->ti_current=%lld (t=%e, a=%e)", diff --git a/src/cell.c b/src/cell.c index eba2ee675b5de9f58090d6fcfc53f7dbe55f235f..8ca6771a43929b924003630f80b56cbf6d185fa8 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2381,7 +2381,7 @@ int cell_unskip_gravity_tasks(struct cell *c, struct scheduler *s) { void cell_set_super(struct cell *c, struct cell *super) { /* Are we in a cell with some kind of self/pair task ? */ - if (super == NULL && c->nr_tasks > 0) super = c; + if (super == NULL && (c->nr_tasks > 0 || c->nr_mm_tasks > 0)) super = c; /* Set the super-cell */ c->super = super; diff --git a/src/cell.h b/src/cell.h index 534f9d704dc28901044860bda8a0ae97cff5d945..ed017d2d11f6612321df5a7bb9c514dd3b5179f9 100644 --- a/src/cell.h +++ b/src/cell.h @@ -428,6 +428,9 @@ struct cell { /*! Number of tasks that are associated with this cell. */ short int nr_tasks; + /*! Number of M-M tasks that are associated with this cell. */ + short int nr_mm_tasks; + /*! The depth of this cell in the tree. */ char depth; diff --git a/src/engine.c b/src/engine.c index 6a840379fc0980ad359a85b77de1e1c3eb177f73..93c033d0c398e7a0e9865ab1feb5e0ef5c34d290 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4757,7 +4757,7 @@ void engine_step(struct engine *e) { e->min_active_bin = get_min_active_bin(e->ti_current, e->ti_old); e->step += 1; e->step_props = engine_step_prop_none; - + /* When restarting, move everyone to the current time. */ if (e->restarting) engine_drift_all(e); diff --git a/src/scheduler.c b/src/scheduler.c index 8204351c2b5d06101b609f5977834e241459a94c..16e627f27a3d186506105a56249f9d3f4a8fe8aa 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -895,8 +895,8 @@ static void scheduler_splittask_gravity(struct task *t, struct scheduler *s) { t->subtype = task_subtype_none; /* Since this task will not be split, we can already link it */ - atomic_inc(&ci->nr_tasks); - atomic_inc(&cj->nr_tasks); + atomic_inc(&ci->nr_mm_tasks); + atomic_inc(&cj->nr_mm_tasks); engine_addlink(e, &ci->grav_mm, t); engine_addlink(e, &cj->grav_mm, t); break; diff --git a/src/space.c b/src/space.c index caf7795536df7994dbb360025e10826893b9a2e1..81efe998471f55c4b9570018ecaee3040195ebe8 100644 --- a/src/space.c +++ b/src/space.c @@ -164,6 +164,7 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements, multipole_rec_end); c->sorts = NULL; c->nr_tasks = 0; + c->nr_mm_tasks = 0; c->density = NULL; c->gradient = NULL; c->force = NULL;