Commit 7aec67f4 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Moved the particle drifting mapper from the runner to the engine.

parent 17157f90
...@@ -3136,6 +3136,32 @@ void engine_unskip(struct engine *e) { ...@@ -3136,6 +3136,32 @@ void engine_unskip(struct engine *e) {
clocks_getunit()); 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. * @brief Drift *all* particles forward to the current time.
* *
...@@ -3144,7 +3170,7 @@ void engine_unskip(struct engine *e) { ...@@ -3144,7 +3170,7 @@ void engine_unskip(struct engine *e) {
void engine_drift_all(struct engine *e) { void engine_drift_all(struct engine *e) {
const ticks tic = getticks(); 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); e->s->nr_cells, sizeof(struct cell), 1, e);
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
......
...@@ -819,31 +819,6 @@ void runner_do_drift_particles(struct runner *r, struct cell *c, int timer) { ...@@ -819,31 +819,6 @@ void runner_do_drift_particles(struct runner *r, struct cell *c, int timer) {
if (timer) TIMER_TOC(timer_drift); 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. * @brief Perform the first half-kick on all the active particles in a cell.
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment