diff --git a/src/runner.c b/src/runner.c index 5b56810fd17b86dc20f31e00c82a34fd3d88ccac..0d170abb3d2f8cc9d31088de00ed715e64819ddb 100644 --- a/src/runner.c +++ b/src/runner.c @@ -332,9 +332,13 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int cleanup, float buff[8]; TIMER_TIC; + + /* We need to do the local sorts plus whatever was requested further up. */ + flags |= c->do_sort; + if (flags == 0 && !c->do_sub_sort) return; /* Check that the particles have been moved to the current time */ - if (!cell_are_part_drifted(c, r->e)) error("Sorting un-drifted cell"); + if (flags && !cell_are_part_drifted(c, r->e)) error("Sorting un-drifted cell"); #ifdef SWIFT_DEBUG_CHECKS /* Make sure the sort flags are consistent (downward). */ @@ -347,17 +351,6 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int cleanup, } #endif - /* Clean-up the flags, i.e. filter out what's already been sorted unless - we're cleaning up. */ - if (cleanup && c->dx_max_sort > 0.0f) { - /* Clear stale sorts. */ - c->sorted = 0; - } else { - /* Ignore dimensions that are already sorted. */ - flags &= ~c->sorted; - } - if (flags == 0) return; - /* Update the sort timer which represents the last time the sorts were re-set. */ if (c->sorted == 0) c->ti_sort = r->e->ti_current;