Commit ef92daeb authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Make the cell drift function abort the recursion early if they are empty.

parent c4bf98ea
......@@ -3245,6 +3245,21 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
if (ti_current < ti_old_part) error("Attempt to drift to the past");
#endif
/* Early abort? */
if (c->hydro.count == 0) {
/* Clear the drift flags. */
c->hydro.do_drift = 0;
c->hydro.do_sub_drift = 0;
/* Update the time of the last drift */
c->hydro.ti_old_part = ti_current;
return;
}
/* Ok, we have some particles somewhere in the hierarchy to drift */
/* Are we not in a leaf ? */
if (c->split && (force || c->hydro.do_sub_drift)) {
......@@ -3415,6 +3430,21 @@ void cell_drift_gpart(struct cell *c, const struct engine *e, int force) {
if (ti_current < ti_old_gpart) error("Attempt to drift to the past");
#endif
/* Early abort? */
if (c->grav.count == 0) {
/* Clear the drift flags. */
c->grav.do_drift = 0;
c->grav.do_sub_drift = 0;
/* Update the time of the last drift */
c->grav.ti_old_part = ti_current;
return;
}
/* Ok, we have some particles somewhere in the hierarchy to drift */
/* Are we not in a leaf ? */
if (c->split && (force || c->grav.do_sub_drift)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment