diff --git a/src/cell.c b/src/cell.c index 522870410222224e77ff8b7c3a147ebd13dd7eb4..c7c10bcf666f576b0689660edcf7af7552a5eb15 100644 --- a/src/cell.c +++ b/src/cell.c @@ -4999,45 +4999,3 @@ int cell_can_use_pair_mm_rebuild(const struct cell *ci, const struct cell *cj, return gravity_M2L_accept(multi_i->r_max_rebuild, multi_j->r_max_rebuild, theta_crit2, r2); } - - -/** - * @brief Updates the hydro h_max in all the cell above. - * - * This function is used when h_max is updated in the ghost. - * - * @param c The #cell to update. - * @param h_max The new h_max. - */ -void cell_update_hydro_h_max(struct cell *c, double h_max) { - - /* Check if new h_max is larger */ - if (h_max > c->hydro.h_max) { - c->hydro.h_max = h_max; - - /* Update parents */ - if (c->parent != NULL) - cell_update_hydro_h_max(c->parent, h_max); - } -} - - -/** - * @brief Updates the stars h_max in all the cell above. - * - * This function is used when h_max is updated in the ghost. - * - * @param c The #cell to update. - * @param h_max The new h_max. - */ -void cell_update_stars_h_max(struct cell *c, double h_max) { - - /* Check if new h_max is larger */ - if (h_max > c->stars.h_max) { - c->stars.h_max = h_max; - - /* Update parents */ - if (c->parent != NULL) - cell_update_stars_h_max(c->parent, h_max); - } -} diff --git a/src/cell.h b/src/cell.h index 42b74dae36c758b613394d8c16b10a24be555768..e76657349eaf32e795054036e9c451edb03f8c8b 100644 --- a/src/cell.h +++ b/src/cell.h @@ -799,8 +799,6 @@ int cell_can_use_pair_mm(const struct cell *ci, const struct cell *cj, const struct engine *e, const struct space *s); int cell_can_use_pair_mm_rebuild(const struct cell *ci, const struct cell *cj, const struct engine *e, const struct space *s); -void cell_update_hydro_h_max(struct cell *c, double h_max); -void cell_update_stars_h_max(struct cell *c, double h_max); /** * @brief Compute the square of the minimal distance between any two points in diff --git a/src/runner.c b/src/runner.c index 1a63b440f9f2ff46ae6abe276d7876558da08abc..6edb34414df705a49b528d9d731bcba35ff9c359 100644 --- a/src/runner.c +++ b/src/runner.c @@ -154,7 +154,13 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { /* Recurse? */ if (c->split) { for (int k = 0; k < 8; k++) - if (c->progeny[k] != NULL) runner_do_stars_ghost(r, c->progeny[k], 0); + if (c->progeny[k] != NULL) { + runner_do_stars_ghost(r, c->progeny[k], 0); + + /* update h_max */ + if (c->progeny[k]->stars.h_max > c->stars.h_max) + c->stars.h_max = c->progeny[k]->stars.h_max; + } } else { /* Init the list of active particles that have to be updated. */ @@ -418,7 +424,9 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { free(h_0); } - cell_update_stars_h_max(c, h_max); + /* update h_max */ + if (h_max > c->stars.h_max) + c->stars.h_max = h_max; if (timer) TIMER_TOC(timer_dostars_ghost); } @@ -1365,7 +1373,12 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { /* Recurse? */ if (c->split) { for (int k = 0; k < 8; k++) - if (c->progeny[k] != NULL) runner_do_ghost(r, c->progeny[k], 0); + if (c->progeny[k] != NULL) { + runner_do_ghost(r, c->progeny[k], 0); + /* update h_max */ + if (c->progeny[k]->hydro.h_max > c->hydro.h_max) + c->hydro.h_max = c->progeny[k]->hydro.h_max; + } } else { /* Init the list of active particles that have to be updated and their @@ -1726,7 +1739,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { free(h_0); } - cell_update_hydro_h_max(c, h_max); + /* Update h_max */ + if (h_max > c->hydro.h_max) + c->hydro.h_max = h_max; if (timer) TIMER_TOC(timer_do_ghost); }