diff --git a/src/cell.c b/src/cell.c index 28cb5f3fab11877474804737fdf5e2489b7c866e..48667900c24a4467b2d8f6edb23c9ff3ac9776ba 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1845,6 +1845,32 @@ void cell_clear_limiter_flags(struct cell *c, void *data) { c->hydro.do_sub_limiter = 0; } +/** + * @brief Recurse down in a cell hierarchy until the hydro.super level is reached + * and activate the spart drift at that level. + * + * @param c The #cell to recurse into. + * @param s The #scheduler. + */ +void cell_activate_super_spart_drifts(struct cell *c, struct scheduler *s) { + + if (c == c->hydro.super) { + cell_activate_drift_spart(c, s); + } else { + if (c->split) { + for (int k = 0; k < 8; ++k) { + if (c->progeny[k] != NULL) { + cell_activate_super_spart_drifts(c->progeny[k], s); + } + } + } else { +#ifdef SWIFT_DEBUG_CHECKS + error("Reached a leaf cell without finding a hydro.super!!"); +#endif + } + } +} + /** * @brief Activate the #part drifts on the given cell. */ diff --git a/src/cell.h b/src/cell.h index b0912d33f272e800fdb71db816bde3006582d912..13adc8ae0bef0c80be44d77dae08c25b34a60d56 100644 --- a/src/cell.h +++ b/src/cell.h @@ -774,6 +774,7 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj, struct scheduler *s); void cell_activate_subcell_external_grav_tasks(struct cell *ci, struct scheduler *s); +void cell_activate_super_spart_drifts(struct cell *c, struct scheduler *s); void cell_activate_drift_part(struct cell *c, struct scheduler *s); void cell_activate_drift_gpart(struct cell *c, struct scheduler *s); void cell_activate_drift_spart(struct cell *c, struct scheduler *s); diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index e54465d0bf4b8e072d37b50e74c097086a31b8bc..9fffcdda422da1f37f67826eedfa26e94724444b 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -665,6 +665,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, else if (t_type == task_type_star_formation) { if (cell_is_active_hydro(t->ci, e)) { scheduler_activate(s, t); + cell_activate_super_spart_drifts(t->ci, s); } } }