diff --git a/examples/main.c b/examples/main.c index 602b9abc8ab63e7f33dc74042c2a31ad682db17c..92a18a22fd2ab31b7da0bd44a490be6a60d11795 100644 --- a/examples/main.c +++ b/examples/main.c @@ -779,8 +779,7 @@ int main(int argc, char *argv[]) { if (myrank == 0) message( "Read %lld gas particles, %lld stars particles and %lld gparts from " - "the " - "ICs.", + "the ICs.", N_total[0], N_total[2], N_total[1]); /* Verify that the fields to dump actually exist */ diff --git a/src/engine.c b/src/engine.c index b2687302b4013467736f28338d46b401d4485acb..8774596b86783046b125268cf3ff563486a14f8a 100644 --- a/src/engine.c +++ b/src/engine.c @@ -3784,12 +3784,13 @@ void engine_marktasks_mapper(void *map_data, int num_elements, const int cj_active_hydro = cell_is_active_hydro(cj, e); const int ci_active_gravity = cell_is_active_gravity(ci, e); const int cj_active_gravity = cell_is_active_gravity(cj, e); + const int ci_active_stars = cell_is_active_stars(ci, e); + const int cj_active_stars = cell_is_active_stars(cj, e); /* Only activate tasks that involve a local active cell. */ if ((t->subtype == task_subtype_density || t->subtype == task_subtype_gradient || - t->subtype == task_subtype_force || - t->subtype == task_subtype_stars_density) && + t->subtype == task_subtype_force) && ((ci_active_hydro && ci->nodeID == engine_rank) || (cj_active_hydro && cj->nodeID == engine_rank))) { @@ -3824,6 +3825,44 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } } + /* Stars */ + if (t->subtype == task_subtype_stars_density && + ((ci_active_stars && ci->nodeID == engine_rank) || + (cj_active_stars && cj->nodeID == engine_rank))) { + + scheduler_activate(s, t); + + /* Set the correct sorting flags */ + if (t->type == task_type_pair) { + + /* Store some values. */ + atomic_or(&ci->requires_sorts, 1 << t->flags); + atomic_or(&cj->requires_sorts, 1 << t->flags); + ci->dx_max_sort_old = ci->dx_max_sort; + cj->dx_max_sort_old = cj->dx_max_sort; + + /* Activate the hydro drift tasks. */ + if (ci->nodeID == engine_rank) { + cell_activate_drift_part(ci, s); + cell_activate_drift_gpart(ci, s); + } + if (cj->nodeID == engine_rank) { + cell_activate_drift_part(cj, s); + cell_activate_drift_gpart(cj, s); + } + + /* Check the sorts and activate them if needed. */ + cell_activate_sorts(ci, t->flags, s); + cell_activate_sorts(cj, t->flags, s); + + } + + /* Store current values of dx_max and h_max. */ + else if (t->type == task_type_sub_pair) { + cell_activate_subcell_stars_tasks(t->ci, t->cj, s); + } + } + if ((t->subtype == task_subtype_grav) && ((ci_active_gravity && ci->nodeID == engine_rank) || (cj_active_gravity && cj->nodeID == engine_rank))) { @@ -4129,8 +4168,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements, scheduler_activate(s, t); } - } - /* Star ghost tasks ? */ else if (t->type == task_type_stars_ghost || t->type == task_type_stars_ghost_in ||