From ae8b62f293147206d2c208d0db41cf8a09989623 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 15 Feb 2019 19:33:29 +0100 Subject: [PATCH] First buggy attempt at forcing a re-sort after star formation has occured in a super cell. --- src/runner.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/runner.c b/src/runner.c index ba86e84546..8d8a2e6b6a 100644 --- a/src/runner.c +++ b/src/runner.c @@ -484,7 +484,7 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) { /** * */ -void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { +void runner_do_star_formation(struct runner *r, struct cell *c, int timer, int* formed_stars) { struct engine *e = r->e; const struct cosmology *cosmo = e->cosmology; @@ -508,7 +508,7 @@ void runner_do_star_formation(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_star_formation(r, c->progeny[k], 0); + if (c->progeny[k] != NULL) runner_do_star_formation(r, c->progeny[k], 0, formed_stars); } else { /* Loop over the gas particles in this cell. */ @@ -553,6 +553,9 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { /* Copy the properties of the gas particle to the star particle */ star_formation_copy_properties(p, xp, sp, e, sf_props, cosmo, with_cosmology); + + message("STAR FORMED!!!! super->ID=%d", c->super->cellID); + (*formed_stars)++; } } else { /* Are we not star-forming? */ @@ -566,6 +569,10 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { } /* Loop over particles */ } + if (timer && *formed_stars > 0) { + runner_do_stars_sort(r, c, 0x1FFF, 0, 0); + } + if (timer) TIMER_TOC(timer_do_star_formation); } @@ -3210,7 +3217,10 @@ void *runner_main(void *data) { runner_do_cooling(r, t->ci, 1); break; case task_type_star_formation: - runner_do_star_formation(r, t->ci, 1); + { + int formed_stars = 0; + runner_do_star_formation(r, t->ci, 1, &formed_stars); + } break; default: error("Unknown/invalid task type (%d).", t->type); -- GitLab