diff --git a/src/engine.c b/src/engine.c index deae35f865b710e579ea95a7aa2dd22f0cb74659..6e1bdfbed43e04087e4178e1a20d1c7f0663fa8e 100644 --- a/src/engine.c +++ b/src/engine.c @@ -3136,6 +3136,32 @@ void engine_unskip(struct engine *e) { clocks_getunit()); } +/** + * @brief Mapper function to drift ALL particle types and multipoles forward in + * time. + * + * @param map_data An array of #cell%s. + * @param num_elements Chunk size. + * @param extra_data Pointer to an #engine. + */ +void engine_do_drift_all_mapper(void *map_data, int num_elements, + void *extra_data) { + + struct engine *e = (struct engine *)extra_data; + struct cell *cells = (struct cell *)map_data; + + for (int ind = 0; ind < num_elements; ind++) { + struct cell *c = &cells[ind]; + if (c != NULL && c->nodeID == e->nodeID) { + /* Drift all the particles */ + cell_drift_particles(c, e); + + /* Drift the multipole */ + if (e->policy & engine_policy_self_gravity) cell_drift_multipole(c, e); + } + } +} + /** * @brief Drift *all* particles forward to the current time. * @@ -3144,7 +3170,7 @@ void engine_unskip(struct engine *e) { void engine_drift_all(struct engine *e) { const ticks tic = getticks(); - threadpool_map(&e->threadpool, runner_do_drift_all_mapper, e->s->cells_top, + threadpool_map(&e->threadpool, engine_do_drift_all_mapper, e->s->cells_top, e->s->nr_cells, sizeof(struct cell), 1, e); #ifdef SWIFT_DEBUG_CHECKS diff --git a/src/runner.c b/src/runner.c index ff78e5d679ccf67429ffd0cef1403f3fc0d5cec2..dec6c4e87a7b8e40a5da9e4d23d729bae3b5febe 100644 --- a/src/runner.c +++ b/src/runner.c @@ -819,31 +819,6 @@ void runner_do_drift_particles(struct runner *r, struct cell *c, int timer) { if (timer) TIMER_TOC(timer_drift); } -/** - * @brief Mapper function to drift ALL particle and g-particles forward in time. - * - * @param map_data An array of #cell%s. - * @param num_elements Chunk size. - * @param extra_data Pointer to an #engine. - */ -void runner_do_drift_all_mapper(void *map_data, int num_elements, - void *extra_data) { - - struct engine *e = (struct engine *)extra_data; - struct cell *cells = (struct cell *)map_data; - - for (int ind = 0; ind < num_elements; ind++) { - struct cell *c = &cells[ind]; - if (c != NULL && c->nodeID == e->nodeID) { - /* Drift all the particles */ - cell_drift_particles(c, e); - - /* Drift the multipole */ - if (e->policy & engine_policy_self_gravity) cell_drift_multipole(c, e); - } - } -} - /** * @brief Perform the first half-kick on all the active particles in a cell. *