diff --git a/src/cell.c b/src/cell.c index 2637a9703d33b4c72f6c3c507c4ad314f47cec61..a2ce43c9bd499c1e3aeaacc06d9d47ab6d6b8eac 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2399,6 +2399,11 @@ void cell_clear_limiter_flags(struct cell *c, void *data) { cell_flag_do_hydro_limiter | cell_flag_do_hydro_sub_limiter); } +/** + * @brief Recursively clear the stars_resort flag in a cell hierarchy. + * + * @param c The #cell to act on. + */ void cell_set_star_resort_flag(struct cell *c) { cell_set_flag(c, cell_flag_do_stars_resort); @@ -2412,8 +2417,24 @@ void cell_set_star_resort_flag(struct cell *c) { } } +/** + * @brief Recurses in a cell hierarchy down to the level where the + * star resort tasks are and activates them. + * + * The function will fail if called *below* the super-level + * + * @param c The #cell to recurse into. + * @param s The #scheduler. + */ void cell_activate_star_resort_tasks(struct cell *c, struct scheduler *s) { +#ifdef SWIFT_DEBUG_CHECKS + if (c->hydro.super != NULL && c->hydro.super != c) + error("Function called below the super level!"); +#endif + + /* The resort tasks are at either the chosen depth or the super level, + * whichever comes first. */ if (c->depth == engine_star_resort_task_depth || c->hydro.super == c) { scheduler_activate(s, c->hydro.stars_resort); } else { @@ -2425,9 +2446,19 @@ void cell_activate_star_resort_tasks(struct cell *c, struct scheduler *s) { } } +/** + * @brief Activate the star formation task as well as the resorting of stars + * + * Must be called at the top-level in the tree (where the SF task is...) + * + * @param c The (top-level) #cell. + * @param s The #scheduler. + */ void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s) { +#ifdef SWIFT_DEBUG_CHECKS if (c->depth != 0) error("Function should be called at the top-level only"); +#endif /* Have we already unskipped that task? */ if (c->hydro.star_formation->skip == 0) return; diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 3759ac26f969655edfac9452e044ec954476191c..6a8341068cb87d2994a8d658a9a7255462ef294e 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -977,6 +977,8 @@ void engine_add_ghosts(struct engine *e, struct cell *c, struct task *ghost_in, * * @param e The #engine. * @param c The #cell. + * @param star_resort_cell Pointer to the cell where the star_resort task has + * been created. NULL above that level or if not running with star formation. */ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, struct cell *star_resort_cell) { diff --git a/src/runner.c b/src/runner.c index cfa33ca84dc097a7574f9af7777ac46975ab3680..18e3985425569d8f7300b5383e4819b25fe83837 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1180,7 +1180,8 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { /* Did we get a star? (Or did we run out of spare ones?) */ if (sp != NULL) { - message("We formed a star id=%lld cellID=%d", sp->id, c->cellID); + /* message("We formed a star id=%lld cellID=%d", sp->id, + * c->cellID); */ /* Copy the properties of the gas particle to the star particle */ star_formation_copy_properties(p, xp, sp, e, sf_props, cosmo,