diff --git a/src/runner.c b/src/runner.c index 37109ee458f648dad78491a92f4c6ab45e96cd6f..efae14c3573d7916af0c7fc5222040b350972152 100644 --- a/src/runner.c +++ b/src/runner.c @@ -84,8 +84,7 @@ const double runner_shift[13][3] = { {0.0, 7.071067811865475e-01, 7.071067811865475e-01}, {0.0, 1.0, 0.0}, {0.0, 7.071067811865475e-01, -7.071067811865475e-01}, - {0.0, 0.0, 1.0}, -}; + {0.0, 0.0, 1.0}, }; /* Does the axis need flipping ? */ const char runner_flip[27] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, @@ -857,6 +856,56 @@ static void runner_do_drift(struct cell *c, struct engine *e) { /* Update the time of the last drift */ c->ti_old = ti_current; + + /* If we aren't going to do anything with this cell, we can stop here. */ + if (c->ti_end_min > ti_current) return; + + /* Un-skip the density tasks involved with this cell. */ + for (struct link *l = c->density; l != NULL; l = l->next) { + struct task *t = l->t; + t->skip = 0; + if (t->type == task_type_pair) { + if (!(c->sorted & (1 << t->flags))) { + c->sorts->flags |= (1 << t->flags); + c->sorts->skip = 0; + } + } + if (t->type == task_type_pair || t->type == task_type_sub_pair) { + const struct cell *ci = t->ci; + const struct cell *cj = t->cj; + if (t->tight && + (max(ci->h_max, cj->h_max) + ci->dx_max + cj->dx_max > cj->dmin || + ci->dx_max > space_maxreldx * ci->h_max || + cj->dx_max > space_maxreldx * cj->h_max)) + e->forcerebuild = 1; +#ifdef WITH_MPI + /* Activate the recv tasks. */ + if (ci->nodeID != engine_rank) { + if (ci->recv_xv != NULL) ci->recv_xv->skip = 0; + if (ci->recv_rho != NULL) ci->recv_rho->skip = 0; + if (ci->recv_ti != NULL) ci->recv_ti->skip = 0; + } else if (cj->nodeID != engine_rank) { + if (cj->recv_xv != NULL) cj->recv_xv->skip = 0; + if (cj->recv_rho != NULL) cj->recv_rho->skip = 0; + if (cj->recv_ti != NULL) cj->recv_ti->skip = 0; + } +#endif + } + } + + /* Unskip all the other task types. */ + for (struct link *l = c->gradient; l != NULL; l = l->next) l->t->skip = 0; + for (struct link *l = c->force; l != NULL; l = l->next) l->t->skip = 0; + for (struct link *l = c->grav; l != NULL; l = l->next) l->t->skip = 0; +#ifdef WITH_MPI + for (struct link *l = c->send_xv; l != NULL; l = l->next) l->t->skip = 0; + for (struct link *l = c->send_rho; l != NULL; l = l->next) l->t->skip = 0; + for (struct link *l = c->send_ti; l != NULL; l = l->next) l->t->skip = 0; +#endif + if (c->extra_ghost != NULL) c->extra_ghost->skip = 0; + if (c->ghost != NULL) c->ghost->skip = 0; + if (c->init != NULL) c->init->skip = 0; + if (c->kick != NULL) c->kick->skip = 0; } /**