diff --git a/src/cell.c b/src/cell.c index eed219e0c9977d5f416f3725012ee954160e5f95..8c25b17f9996027e383ceeba16ae8451c34b1c7b 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2138,8 +2138,8 @@ void cell_clear_drift_flags(struct cell *c, void *data) { * @brief Clear the limiter flags on the given cell. */ void cell_clear_limiter_flags(struct cell *c, void *data) { - cell_clear_flag(c, cell_flag_do_hydro_limiter); - c->hydro.do_sub_limiter = 0; + cell_clear_flag(c, + cell_flag_do_hydro_limiter & cell_flag_do_hydro_sub_limiter); } /** @@ -2310,11 +2310,12 @@ void cell_activate_limiter(struct cell *c, struct scheduler *s) { scheduler_activate(s, c->timestep_limiter); } else { for (struct cell *parent = c->parent; - parent != NULL && !parent->hydro.do_sub_limiter; + parent != NULL && + !cell_get_flag(parent, cell_flag_do_hydro_sub_limiter); parent = parent->parent) { /* Mark this cell for limiting */ - parent->hydro.do_sub_limiter = 1; + cell_set_flag(parent, cell_flag_do_hydro_sub_limiter); if (parent == c->super) { #ifdef SWIFT_DEBUG_CHECKS diff --git a/src/cell.h b/src/cell.h index de624e204dacd39e1f3af5b6d10a6c2b42e6d12f..b31a229dcc89870204c5450377931729fa88dd38 100644 --- a/src/cell.h +++ b/src/cell.h @@ -28,6 +28,7 @@ /* Includes. */ #include <stddef.h> +#include <stdint.h> /* Local includes. */ #include "align.h" @@ -374,16 +375,13 @@ struct cell { int hold; /*! Bit mask of sort directions that will be needed in the next timestep. */ - unsigned int requires_sorts; + uint16_t requires_sorts; /*! Bit mask of sorts that need to be computed for this cell. */ - unsigned int do_sort; + uint16_t do_sort; /*! Bit-mask indicating the sorted directions */ - unsigned int sorted; - - /*! Do any of this cell's sub-cells need to be limited? */ - char do_sub_limiter; + uint16_t sorted; #ifdef SWIFT_DEBUG_CHECKS @@ -552,18 +550,18 @@ struct cell { /*! Values of dx_max_sort before the drifts, used for sub-cell tasks. */ float dx_max_sort_old; - /*! Bit mask of sort directions that will be needed in the next timestep. */ - unsigned int requires_sorts; - /*! Pointer for the sorted indices. */ struct entry *sort[13]; struct entry *sortptr; + /*! Bit mask of sort directions that will be needed in the next timestep. */ + uint16_t requires_sorts; + /*! Bit-mask indicating the sorted directions */ - unsigned int sorted; + uint16_t sorted; /*! Bit mask of sorts that need to be computed for this cell. */ - unsigned int do_sort; + uint16_t do_sort; /*! Do any of this cell's sub-cells need to be sorted? */ char do_sub_sort; diff --git a/src/runner.c b/src/runner.c index 113aa4753a89304b69d0c20dc7ca2faf83506dd2..b9c6f151924432937c7d7dff42517c41021b04c1 100644 --- a/src/runner.c +++ b/src/runner.c @@ -2871,13 +2871,13 @@ void runner_do_limiter(struct runner *r, struct cell *c, int force, int timer) { if (c->hydro.count == 0) { /* Clear the limiter flags. */ - cell_clear_flag(c, cell_flag_do_hydro_limiter); - c->hydro.do_sub_limiter = 0; + cell_clear_flag( + c, cell_flag_do_hydro_limiter & cell_flag_do_hydro_sub_limiter); return; } /* Loop over the progeny ? */ - if (c->split && (force || c->hydro.do_sub_limiter)) { + if (c->split && (force || cell_get_flag(c, cell_flag_do_hydro_sub_limiter))) { for (int k = 0; k < 8; k++) { if (c->progeny[k] != NULL) { struct cell *restrict cp = c->progeny[k]; @@ -2967,8 +2967,8 @@ void runner_do_limiter(struct runner *r, struct cell *c, int force, int timer) { } /* Clear the limiter flags. */ - cell_clear_flag(c, cell_flag_do_hydro_limiter); - c->hydro.do_sub_limiter = 0; + cell_clear_flag(c, + cell_flag_do_hydro_limiter & cell_flag_do_hydro_sub_limiter); if (timer) TIMER_TOC(timer_do_limiter); } diff --git a/src/space.c b/src/space.c index c31d2dfbd46524ac9512ba192c48cb6c822b7a6f..5dfbab9acddfaf5fa2e2b5a0bd376d1e40391b34 100644 --- a/src/space.c +++ b/src/space.c @@ -262,7 +262,6 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements, c->grav.do_sub_drift = 0; c->stars.do_sub_drift = 0; c->black_holes.do_sub_drift = 0; - c->hydro.do_sub_limiter = 0; c->hydro.ti_end_min = -1; c->hydro.ti_end_max = -1; c->grav.ti_end_min = -1; @@ -3326,7 +3325,6 @@ void space_split_recursive(struct space *s, struct cell *c, cp->flags = 0; cp->stars.do_sub_drift = 0; cp->black_holes.do_sub_drift = 0; - cp->hydro.do_sub_limiter = 0; #ifdef WITH_MPI cp->mpi.tag = -1; #endif // WITH_MPI