diff --git a/src/cell.c b/src/cell.c index e8a5313dd58d27b0d08fd023bfbb60bcb1de7bcc..5b0cde57dade1df69f69147a61959f9a7d6ee628 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2127,8 +2127,7 @@ void cell_clean(struct cell *c) { * @brief Clear the drift flags on the given cell. */ void cell_clear_drift_flags(struct cell *c, void *data) { - cell_clear_flag(c, cell_flag_do_hydro_drift); - c->hydro.do_sub_drift = 0; + cell_clear_flag(c, cell_flag_do_hydro_drift & cell_flag_do_hydro_sub_drift); c->grav.do_drift = 0; c->grav.do_sub_drift = 0; c->stars.do_drift = 0; @@ -2190,11 +2189,11 @@ void cell_activate_drift_part(struct cell *c, struct scheduler *s) { scheduler_activate(s, c->hydro.drift); } else { for (struct cell *parent = c->parent; - parent != NULL && !parent->hydro.do_sub_drift; + parent != NULL && !cell_get_flag(parent, cell_flag_do_hydro_sub_drift); parent = parent->parent) { /* Mark this cell for drifting */ - parent->hydro.do_sub_drift = 1; + cell_set_flag(parent, cell_flag_do_hydro_sub_drift); if (parent == c->hydro.super) { #ifdef SWIFT_DEBUG_CHECKS @@ -4111,8 +4110,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) { if (c->hydro.count == 0) { /* Clear the drift flags. */ - cell_clear_flag(c, cell_flag_do_hydro_drift); - c->hydro.do_sub_drift = 0; + cell_clear_flag(c, cell_flag_do_hydro_drift & cell_flag_do_hydro_sub_drift); /* Update the time of the last drift */ c->hydro.ti_old_part = ti_current; @@ -4123,7 +4121,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) { /* 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)) { + if (c->split && (force || cell_get_flag(c, cell_flag_do_hydro_sub_drift))) { /* Loop over the progeny and collect their data. */ for (int k = 0; k < 8; k++) { @@ -4260,8 +4258,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) { } /* Clear the drift flags. */ - cell_clear_flag(c, cell_flag_do_hydro_drift); - c->hydro.do_sub_drift = 0; + cell_clear_flag(c, cell_flag_do_hydro_drift & cell_flag_do_hydro_sub_drift); } /** diff --git a/src/cell.h b/src/cell.h index fd9965ee943f4b1828ef4293844a69ba586941d0..218d3d45169dbab9946a2fc7896ff6d4d4eac36c 100644 --- a/src/cell.h +++ b/src/cell.h @@ -382,9 +382,6 @@ struct cell { /*! Bit-mask indicating the sorted directions */ unsigned int sorted; - /*! Do any of this cell's sub-cells need to be drifted (hydro)? */ - char do_sub_drift; - /*! Do any of this cell's sub-cells need to be sorted? */ char do_sub_sort; diff --git a/src/space.c b/src/space.c index ea1d453849e406dc27f634dd15837120fcf92d5f..660a6a42ad3e6025dfd030bf0348629a5c56f73a 100644 --- a/src/space.c +++ b/src/space.c @@ -259,7 +259,7 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements, c->black_holes.parts = NULL; c->hydro.do_sub_sort = 0; c->stars.do_sub_sort = 0; - c->hydro.do_sub_drift = 0; + c->flags = 0; c->grav.do_sub_drift = 0; c->stars.do_sub_drift = 0; c->black_holes.do_sub_drift = 0; @@ -3326,7 +3326,7 @@ void space_split_recursive(struct space *s, struct cell *c, cp->hydro.do_sub_sort = 0; cp->stars.do_sub_sort = 0; cp->grav.do_sub_drift = 0; - cp->hydro.do_sub_drift = 0; + cp->flags = 0; cp->stars.do_sub_drift = 0; cp->black_holes.do_sub_drift = 0; cp->hydro.do_sub_limiter = 0;