diff --git a/src/cell.c b/src/cell.c index 7ced653d2e1da294a598ea86045e6e3bb5577f63..4502f5d265dc68540e16ed0e51e681cf5733f842 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1893,6 +1893,13 @@ void cell_set_super(struct cell *c, struct cell *super) { if (c->progeny[k] != NULL) cell_set_super(c->progeny[k], super); } +void cell_set_super_mapper(void *map_data, int num_elements, void *extra_data) { + for (int ind = 0; ind < num_elements; ind++) { + struct cell *c = &((struct cell *)map_data)[ind]; + cell_set_super(c, NULL); + } +} + /** * @brief Recursively drifts the #part in a cell hierarchy. * diff --git a/src/cell.h b/src/cell.h index 82035695d465a681539de86db7c3bf68cad928da..e97400623dbb7a66aee981d21883fe4d8f73406a 100644 --- a/src/cell.h +++ b/src/cell.h @@ -404,6 +404,7 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj, void cell_activate_drift_part(struct cell *c, struct scheduler *s); void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s); void cell_clear_drift_flags(struct cell *c, void *data); +void cell_set_super_mapper(void *map_data, int num_elements, void *extra_data); /* Inlined functions (for speed). */ diff --git a/src/engine.c b/src/engine.c index 37a5a316718629e6e2eae002a49dffe198856d0d..28904eacf7aa4a83448cdd5135138a8eecf25505 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2511,7 +2511,8 @@ void engine_maketasks(struct engine *e) { /* Now that the self/pair tasks are at the right level, set the super * pointers. */ - for (int k = 0; k < nr_cells; k++) cell_set_super(&cells[k], NULL); + threadpool_map(&e->threadpool, cell_set_super_mapper, cells, nr_cells, + sizeof(struct cell), 0, NULL); /* Append hierarchical tasks to each cell. */ for (int k = 0; k < nr_cells; k++)