Commit 0473da3a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Applied code formatting tool.

parent 48df22d5
...@@ -2025,8 +2025,10 @@ void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) { ...@@ -2025,8 +2025,10 @@ void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) {
parent->stars.do_sub_sort = 1; parent->stars.do_sub_sort = 1;
if (parent == c->hydro.super) { if (parent == c->hydro.super) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if ((parent->nodeID == engine_rank && parent->stars.sorts_local == NULL) || if ((parent->nodeID == engine_rank &&
(parent->nodeID != engine_rank && parent->stars.sorts_foreign == NULL)) parent->stars.sorts_local == NULL) ||
(parent->nodeID != engine_rank &&
parent->stars.sorts_foreign == NULL))
error("Trying to activate un-existing parents->stars.sorts"); error("Trying to activate un-existing parents->stars.sorts");
#endif #endif
if (parent->nodeID == engine_rank) { if (parent->nodeID == engine_rank) {
...@@ -3343,7 +3345,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { ...@@ -3343,7 +3345,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) {
struct engine *e = s->space->e; struct engine *e = s->space->e;
const int nodeID = e->nodeID; const int nodeID = e->nodeID;
int rebuild = 0; int rebuild = 0;
/* Un-skip the density tasks involved with this cell. */ /* Un-skip the density tasks involved with this cell. */
for (struct link *l = c->stars.density; l != NULL; l = l->next) { for (struct link *l = c->stars.density; l != NULL; l = l->next) {
struct task *t = l->t; struct task *t = l->t;
...@@ -3354,11 +3356,10 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { ...@@ -3354,11 +3356,10 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) {
const int ci_nodeID = ci->nodeID; const int ci_nodeID = ci->nodeID;
const int cj_nodeID = (cj != NULL) ? cj->nodeID : -1; const int cj_nodeID = (cj != NULL) ? cj->nodeID : -1;
if (t->type == task_type_self && if (t->type == task_type_self && ci_active && ci->nodeID == nodeID) {
ci_active && ci->nodeID == nodeID) {
cell_activate_drift_part(ci, s); cell_activate_drift_part(ci, s);
cell_activate_drift_spart(ci, s); cell_activate_drift_spart(ci, s);
} }
/* Activate cells that contains either a density or a feedback task */ /* Activate cells that contains either a density or a feedback task */
...@@ -3430,21 +3431,21 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { ...@@ -3430,21 +3431,21 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) {
if (cj_active) { if (cj_active) {
scheduler_activate(s, ci->mpi.hydro.recv_xv); scheduler_activate(s, ci->mpi.hydro.recv_xv);
/* If the local cell is active, more stuff will be needed. /* If the local cell is active, more stuff will be needed.
*/ */
scheduler_activate_send(s, cj->mpi.stars.send, ci_nodeID); scheduler_activate_send(s, cj->mpi.stars.send, ci_nodeID);
/* If the local cell is active, send its ti_end values. */ /* If the local cell is active, send its ti_end values. */
scheduler_activate_send(s, cj->mpi.send_ti, ci_nodeID); scheduler_activate_send(s, cj->mpi.send_ti, ci_nodeID);
} }
if (ci_active) { if (ci_active) {
scheduler_activate(s, ci->mpi.stars.recv); scheduler_activate(s, ci->mpi.stars.recv);
/* If the foreign cell is active, we want its ti_end values. */ /* If the foreign cell is active, we want its ti_end values. */
scheduler_activate(s, ci->mpi.recv_ti); scheduler_activate(s, ci->mpi.recv_ti);
/* Is the foreign cell active and will need stuff from us? */ /* Is the foreign cell active and will need stuff from us? */
scheduler_activate_send(s, cj->mpi.hydro.send_xv, ci_nodeID); scheduler_activate_send(s, cj->mpi.hydro.send_xv, ci_nodeID);
/* Drift the cell which will be sent; note that not all sent /* Drift the cell which will be sent; note that not all sent
...@@ -3458,28 +3459,27 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { ...@@ -3458,28 +3459,27 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) {
if (ci_active) { if (ci_active) {
scheduler_activate(s, cj->mpi.hydro.recv_xv); scheduler_activate(s, cj->mpi.hydro.recv_xv);
/* If the local cell is active, more stuff will be needed. /* If the local cell is active, more stuff will be needed.
*/ */
scheduler_activate_send(s, ci->mpi.stars.send, cj_nodeID); scheduler_activate_send(s, ci->mpi.stars.send, cj_nodeID);
/* If the local cell is active, send its ti_end values. */ /* If the local cell is active, send its ti_end values. */
scheduler_activate_send(s, ci->mpi.send_ti, cj_nodeID); scheduler_activate_send(s, ci->mpi.send_ti, cj_nodeID);
} }
if (cj_active) { if (cj_active) {
scheduler_activate(s, cj->mpi.stars.recv); scheduler_activate(s, cj->mpi.stars.recv);
/* If the foreign cell is active, we want its ti_end values. */ /* If the foreign cell is active, we want its ti_end values. */
scheduler_activate(s, cj->mpi.recv_ti); scheduler_activate(s, cj->mpi.recv_ti);
/* Is the foreign cell active and will need stuff from us? */ /* Is the foreign cell active and will need stuff from us? */
scheduler_activate_send(s, ci->mpi.hydro.send_xv, cj_nodeID); scheduler_activate_send(s, ci->mpi.hydro.send_xv, cj_nodeID);
/* Drift the cell which will be sent; note that not all sent /* Drift the cell which will be sent; note that not all sent
particles will be drifted, only those that are needed. */ particles will be drifted, only those that are needed. */
cell_activate_drift_part(ci, s); cell_activate_drift_part(ci, s);
} }
} }
#endif #endif
} }
......
...@@ -868,16 +868,18 @@ cell_can_recurse_in_self_hydro_task(const struct cell *c) { ...@@ -868,16 +868,18 @@ cell_can_recurse_in_self_hydro_task(const struct cell *c) {
* @param cj The #cell with hydro parts. * @param cj The #cell with hydro parts.
*/ */
__attribute__((always_inline)) INLINE static int __attribute__((always_inline)) INLINE static int
cell_can_recurse_in_pair_stars_task(const struct cell *ci, const struct cell *cj) { cell_can_recurse_in_pair_stars_task(const struct cell *ci,
const struct cell *cj) {
/* Is the cell split ? */ /* Is the cell split ? */
/* If so, is the cut-off radius plus the max distance the parts have moved */ /* If so, is the cut-off radius plus the max distance the parts have moved */
/* smaller than the sub-cell sizes ? */ /* smaller than the sub-cell sizes ? */
/* Note: We use the _old values as these might have been updated by a drift */ /* Note: We use the _old values as these might have been updated by a drift */
return ci->split && cj->split && ((kernel_gamma * ci->stars.h_max_old + return ci->split && cj->split &&
ci->stars.dx_max_part_old) < 0.5f * ci->dmin) && ((kernel_gamma * ci->stars.h_max_old + ci->stars.dx_max_part_old) <
((kernel_gamma * cj->hydro.h_max_old + 0.5f * ci->dmin) &&
cj->hydro.dx_max_part_old) < 0.5f * cj->dmin); ((kernel_gamma * cj->hydro.h_max_old + cj->hydro.dx_max_part_old) <
0.5f * cj->dmin);
} }
/** /**
...@@ -891,7 +893,7 @@ cell_can_recurse_in_self_stars_task(const struct cell *c) { ...@@ -891,7 +893,7 @@ cell_can_recurse_in_self_stars_task(const struct cell *c) {
/* Is the cell split and not smaller than the smoothing length? */ /* Is the cell split and not smaller than the smoothing length? */
return c->split && (kernel_gamma * c->stars.h_max_old < 0.5f * c->dmin) && return c->split && (kernel_gamma * c->stars.h_max_old < 0.5f * c->dmin) &&
(kernel_gamma * c->hydro.h_max_old < 0.5f * c->dmin); (kernel_gamma * c->hydro.h_max_old < 0.5f * c->dmin);
} }
/** /**
...@@ -946,8 +948,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_pair_stars_task( ...@@ -946,8 +948,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_pair_stars_task(
/* Note that since tasks are create after a rebuild no need to take */ /* Note that since tasks are create after a rebuild no need to take */
/* into account any part motion (i.e. dx_max == 0 here) */ /* into account any part motion (i.e. dx_max == 0 here) */
return ci->split && cj->split && return ci->split && cj->split &&
(space_stretch * kernel_gamma * ci->stars.h_max < 0.5f * ci->dmin) && (space_stretch * kernel_gamma * ci->stars.h_max < 0.5f * ci->dmin) &&
(space_stretch * kernel_gamma * cj->hydro.h_max < 0.5f * cj->dmin); (space_stretch * kernel_gamma * cj->hydro.h_max < 0.5f * cj->dmin);
} }
/** /**
...@@ -965,8 +967,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_self_stars_task( ...@@ -965,8 +967,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_self_stars_task(
/* Note: No need for more checks here as all the sub-pairs and sub-self */ /* Note: No need for more checks here as all the sub-pairs and sub-self */
/* tasks will be created. So no need to check for h_max */ /* tasks will be created. So no need to check for h_max */
return c->split && return c->split &&
(space_stretch * kernel_gamma * c->stars.h_max < 0.5f * c->dmin) && (space_stretch * kernel_gamma * c->stars.h_max < 0.5f * c->dmin) &&
(space_stretch * kernel_gamma * c->hydro.h_max < 0.5f * c->dmin); (space_stretch * kernel_gamma * c->hydro.h_max < 0.5f * c->dmin);
} }
/** /**
......
...@@ -2684,8 +2684,9 @@ void engine_skip_force_and_kick(struct engine *e) { ...@@ -2684,8 +2684,9 @@ void engine_skip_force_and_kick(struct engine *e) {
t->type == task_type_grav_long_range || t->type == task_type_grav_mm || t->type == task_type_grav_long_range || t->type == task_type_grav_mm ||
t->type == task_type_grav_down || t->type == task_type_cooling || t->type == task_type_grav_down || t->type == task_type_cooling ||
t->type == task_type_star_formation || t->type == task_type_star_formation ||
t->type == task_type_extra_ghost || t->subtype == task_subtype_gradient || t->type == task_type_extra_ghost ||
t->subtype == task_subtype_stars_feedback) t->subtype == task_subtype_gradient ||
t->subtype == task_subtype_stars_feedback)
t->skip = 1; t->skip = 1;
} }
......
...@@ -496,18 +496,15 @@ void engine_addtasks_recv_stars(struct engine *e, struct cell *c, ...@@ -496,18 +496,15 @@ void engine_addtasks_recv_stars(struct engine *e, struct cell *c,
} }
struct task *recv_rho = NULL; struct task *recv_rho = NULL;
if (c->mpi.hydro.recv_rho != NULL) if (c->mpi.hydro.recv_rho != NULL) recv_rho = c->mpi.hydro.recv_rho;
recv_rho = c->mpi.hydro.recv_rho;
for (struct link *l = c->stars.feedback; l != NULL; l = l->next) { for (struct link *l = c->stars.feedback; l != NULL; l = l->next) {
scheduler_addunlock(s, t_feed, l->t); scheduler_addunlock(s, t_feed, l->t);
/* Need gas density before feedback */ /* Need gas density before feedback */
if (recv_rho != NULL) if (recv_rho != NULL) scheduler_addunlock(s, c->mpi.hydro.recv_rho, l->t);
scheduler_addunlock(s, c->mpi.hydro.recv_rho, l->t);
} }
/* Recurse? */ /* Recurse? */
if (c->split) if (c->split)
for (int k = 0; k < 8; k++) for (int k = 0; k < 8; k++)
...@@ -979,7 +976,7 @@ void engine_make_hierarchical_tasks_stars(struct engine *e, struct cell *c) { ...@@ -979,7 +976,7 @@ void engine_make_hierarchical_tasks_stars(struct engine *e, struct cell *c) {
/* Need to compute the gas density before moving to the feedback */ /* Need to compute the gas density before moving to the feedback */
scheduler_addunlock(s, c->hydro.super->hydro.ghost_out, scheduler_addunlock(s, c->hydro.super->hydro.ghost_out,
c->hydro.super->stars.ghost_out); c->hydro.super->stars.ghost_out);
} }
} else { /* We are above the super-cell so need to go deeper */ } else { /* We are above the super-cell so need to go deeper */
...@@ -2050,12 +2047,12 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, ...@@ -2050,12 +2047,12 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements,
} }
if (t->cj->nodeID == engine_rank) { if (t->cj->nodeID == engine_rank) {
if (t->ci->hydro.super != t->cj->hydro.super) { if (t->ci->hydro.super != t->cj->hydro.super) {
scheduler_addunlock(sched, t->cj->hydro.super->stars.sorts_local, t); scheduler_addunlock(sched, t->cj->hydro.super->stars.sorts_local, t);
} }
if (t->ci->super != t->cj->super) { if (t->ci->super != t->cj->super) {
scheduler_addunlock(sched, t->cj->super->grav.drift, t); scheduler_addunlock(sched, t->cj->super->grav.drift, t);
} }
} }
/* Start by constructing the task for the second stars loop */ /* Start by constructing the task for the second stars loop */
...@@ -2069,7 +2066,8 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, ...@@ -2069,7 +2066,8 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements,
} }
if (t->ci->hydro.super != t->cj->hydro.super) { if (t->ci->hydro.super != t->cj->hydro.super) {
if (t->cj->nodeID != engine_rank) { if (t->cj->nodeID != engine_rank) {
scheduler_addunlock(sched, t->cj->hydro.super->stars.sorts_foreign, t2); scheduler_addunlock(sched, t->cj->hydro.super->stars.sorts_foreign,
t2);
} }
} }
...@@ -2085,7 +2083,7 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, ...@@ -2085,7 +2083,7 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements,
if (t->cj->nodeID == nodeID) { if (t->cj->nodeID == nodeID) {
if (t->ci->hydro.super != t->cj->hydro.super) { if (t->ci->hydro.super != t->cj->hydro.super) {
engine_make_stars_loops_dependencies(sched, t, t2, t->cj); engine_make_stars_loops_dependencies(sched, t, t2, t->cj);
} }
if (t->ci->super != t->cj->super) { if (t->ci->super != t->cj->super) {
scheduler_addunlock(sched, t2, t->cj->super->end_force); scheduler_addunlock(sched, t2, t->cj->super->end_force);
} }
...@@ -2140,12 +2138,12 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, ...@@ -2140,12 +2138,12 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements,
} }
if (t->ci->nodeID == engine_rank) { if (t->ci->nodeID == engine_rank) {
if (t->ci->super != t->cj->super) { if (t->ci->super != t->cj->super) {
scheduler_addunlock(sched, t->ci->super->grav.drift, t); scheduler_addunlock(sched, t->ci->super->grav.drift, t);
} }
if (t->ci->hydro.super != t->cj->hydro.super) { if (t->ci->hydro.super != t->cj->hydro.super) {
scheduler_addunlock(sched, t->ci->hydro.super->stars.sorts_local, t); scheduler_addunlock(sched, t->ci->hydro.super->stars.sorts_local, t);
} }
} }
/* Start by constructing the task for the second stars loop */ /* Start by constructing the task for the second stars loop */
...@@ -2159,7 +2157,8 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, ...@@ -2159,7 +2157,8 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements,
} }
if (t->ci->hydro.super != t->cj->hydro.super) { if (t->ci->hydro.super != t->cj->hydro.super) {
if (t->ci->nodeID != engine_rank) { if (t->ci->nodeID != engine_rank) {
scheduler_addunlock(sched, t->ci->hydro.super->stars.sorts_foreign, t2); scheduler_addunlock(sched, t->ci->hydro.super->stars.sorts_foreign,
t2);
} }
} }
...@@ -2248,8 +2247,7 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements, ...@@ -2248,8 +2247,7 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements,
struct cell *cj = &cells[cjd]; struct cell *cj = &cells[cjd];
/* Is that neighbour local and does it have particles ? */ /* Is that neighbour local and does it have particles ? */
if (cid >= cjd || if (cid >= cjd || (cj->stars.count == 0 && cj->hydro.count == 0) ||
(cj->stars.count == 0 && cj->hydro.count == 0) ||
(ci->nodeID != nodeID && cj->nodeID != nodeID)) (ci->nodeID != nodeID && cj->nodeID != nodeID))
continue; continue;
......
...@@ -114,13 +114,12 @@ void engine_activate_stars_mpi(struct engine *e, struct scheduler *s, ...@@ -114,13 +114,12 @@ void engine_activate_stars_mpi(struct engine *e, struct scheduler *s,
scheduler_activate(s, cj->mpi.recv_ti); scheduler_activate(s, cj->mpi.recv_ti);
struct link *l = struct link *l =
scheduler_activate_send(s, ci->mpi.hydro.send_xv, cj_nodeID); scheduler_activate_send(s, ci->mpi.hydro.send_xv, cj_nodeID);
/* Drift the cell which will be sent at the level at which it is /* Drift the cell which will be sent at the level at which it is
sent, i.e. drift the cell specified in the send task (l->t) sent, i.e. drift the cell specified in the send task (l->t)
itself. */ itself. */
cell_activate_drift_part(l->t->ci, s); cell_activate_drift_part(l->t->ci, s);
} }
} }
} }
...@@ -241,7 +240,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -241,7 +240,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
t_subtype == task_subtype_stars_feedback) { t_subtype == task_subtype_stars_feedback) {
if (cell_is_active_stars(ci, e)) { if (cell_is_active_stars(ci, e)) {
scheduler_activate(s, t); scheduler_activate(s, t);
cell_activate_subcell_stars_tasks(ci, NULL, s); cell_activate_subcell_stars_tasks(ci, NULL, s);
} }
} }
...@@ -333,8 +332,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -333,8 +332,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Stars density and feedback */ /* Stars density and feedback */
if ((t_subtype == task_subtype_stars_density || if ((t_subtype == task_subtype_stars_density ||
t_subtype == task_subtype_stars_feedback) && t_subtype == task_subtype_stars_feedback) &&
(ci_active_stars || cj_active_stars)) { (ci_active_stars || cj_active_stars)) {
scheduler_activate(s, t); scheduler_activate(s, t);
......
...@@ -965,11 +965,10 @@ void runner_do_stars_sort(struct runner *r, struct cell *c, int flags, ...@@ -965,11 +965,10 @@ void runner_do_stars_sort(struct runner *r, struct cell *c, int flags,
for (int k = 0; k < 8; k++) { for (int k = 0; k < 8; k++) {
if (c->progeny[k] != NULL && c->progeny[k]->stars.count > 0) { if (c->progeny[k] != NULL && c->progeny[k]->stars.count > 0) {
/* Only propagate cleanup if the progeny is stale. */ /* Only propagate cleanup if the progeny is stale. */
const int cleanup_prog = cleanup && const int cleanup_prog =
(c->progeny[k]->stars.dx_max_sort_old > cleanup && (c->progeny[k]->stars.dx_max_sort_old >
space_maxreldx * c->progeny[k]->dmin); space_maxreldx * c->progeny[k]->dmin);
runner_do_stars_sort(r, c->progeny[k], flags, runner_do_stars_sort(r, c->progeny[k], flags, cleanup_prog, 0);
cleanup_prog, 0);
dx_max_sort = max(dx_max_sort, c->progeny[k]->stars.dx_max_sort); dx_max_sort = max(dx_max_sort, c->progeny[k]->stars.dx_max_sort);
dx_max_sort_old = dx_max_sort_old =
max(dx_max_sort_old, c->progeny[k]->stars.dx_max_sort_old); max(dx_max_sort_old, c->progeny[k]->stars.dx_max_sort_old);
...@@ -3122,8 +3121,9 @@ void *runner_main(void *data) { ...@@ -3122,8 +3121,9 @@ void *runner_main(void *data) {
case task_type_stars_sort_local: case task_type_stars_sort_local:
case task_type_stars_sort_foreign: case task_type_stars_sort_foreign:
/* Cleanup only if any of the indices went stale. */ /* Cleanup only if any of the indices went stale. */
runner_do_stars_sort(r, ci, t->flags, runner_do_stars_sort(
ci->stars.dx_max_sort_old > space_maxreldx * ci->dmin, 1); r, ci, t->flags,
ci->stars.dx_max_sort_old > space_maxreldx * ci->dmin, 1);
/* Reset the sort flags as our work here is done. */ /* Reset the sort flags as our work here is done. */
t->flags = 0; t->flags = 0;
break; break;
......
...@@ -991,8 +991,8 @@ void DOSUB_SUBSET_STARS(struct runner *r, struct cell *ci, struct spart *sparts, ...@@ -991,8 +991,8 @@ void DOSUB_SUBSET_STARS(struct runner *r, struct cell *ci, struct spart *sparts,
/* Do any of the cells need to be drifted first? */ /* Do any of the cells need to be drifted first? */
if (cell_is_active_stars(ci, e)) { if (cell_is_active_stars(ci, e)) {
if (!cell_are_spart_drifted(ci, e)) error("Cell should be drifted!"); if (!cell_are_spart_drifted(ci, e)) error("Cell should be drifted!");
if (!cell_are_part_drifted(cj, e)) error("Cell should be drifted!"); if (!cell_are_part_drifted(cj, e)) error("Cell should be drifted!");
} }
DOPAIR1_SUBSET_BRANCH_STARS(r, ci, sparts, ind, scount, cj); DOPAIR1_SUBSET_BRANCH_STARS(r, ci, sparts, ind, scount, cj);
...@@ -1146,9 +1146,9 @@ void DOSUB_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj, ...@@ -1146,9 +1146,9 @@ void DOSUB_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj,
/* Should we even bother? */ /* Should we even bother? */
const int should_do_ci = ci->stars.count != 0 && cj->hydro.count != 0 && const int should_do_ci = ci->stars.count != 0 && cj->hydro.count != 0 &&
cell_is_active_stars(ci, e); cell_is_active_stars(ci, e);
const int should_do_cj = cj->stars.count != 0 && ci->hydro.count != 0 && const int should_do_cj = cj->stars.count != 0 && ci->hydro.count != 0 &&
cell_is_active_stars(cj, e); cell_is_active_stars(cj, e);
if (!should_do_ci && !should_do_cj) return; if (!should_do_ci && !should_do_cj) return;
/* Get the type of pair if not specified explicitly. */ /* Get the type of pair if not specified explicitly. */
......
...@@ -1032,13 +1032,13 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) { ...@@ -1032,13 +1032,13 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) {
/* Empty task? */ /* Empty task? */
/* Need defines in order to evaluate after check for t->ci == NULL */ /* Need defines in order to evaluate after check for t->ci == NULL */
const int self = (t->ci != NULL) && t->type == task_type_self && const int self = (t->ci != NULL) && t->type == task_type_self &&
t->ci->stars.count != 0 && t->ci->hydro.count != 0; t->ci->stars.count != 0 && t->ci->hydro.count != 0;
const int pair = (t->ci != NULL) && (t->cj != NULL) && const int pair = (t->ci != NULL) && (t->cj != NULL) &&
t->type == task_type_pair && t->type == task_type_pair &&
((t->ci->stars.count != 0 && t->cj->hydro.count != 0) || ((t->ci->stars.count != 0 && t->cj->hydro.count != 0) ||
(t->cj->stars.count != 0 && t->ci->hydro.count != 0)); (t->cj->stars.count != 0 && t->ci->hydro.count != 0));
if (!self && !pair) { if (!self && !pair) {
t->type = task_type_none; t->type = task_type_none;
t->subtype = task_subtype_none; t->subtype = task_subtype_none;
...@@ -1080,7 +1080,7 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) { ...@@ -1080,7 +1080,7 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) {
t->ci = ci->progeny[first_child]; t->ci = ci->progeny[first_child];
for (int k = first_child + 1; k < 8; k++) for (int k = first_child + 1; k < 8; k++)
if (ci->progeny[k] != NULL && ci->progeny[k]->stars.count != 0 && if (ci->progeny[k] != NULL && ci->progeny[k]->stars.count != 0 &&
ci->progeny[k]->hydro.count != 0) ci->progeny[k]->hydro.count != 0)
scheduler_splittask_stars( scheduler_splittask_stars(
scheduler_addtask(s, task_type_self, t->subtype, 0, 0, scheduler_addtask(s, task_type_self, t->subtype, 0, 0,
ci->progeny[k], NULL), ci->progeny[k], NULL),
...@@ -1091,8 +1091,10 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) { ...@@ -1091,8 +1091,10 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) {
if (ci->progeny[j] != NULL) if (ci->progeny[j] != NULL)
for (int k = j + 1; k < 8; k++) for (int k = j + 1; k < 8; k++)
if (ci->progeny[k] != NULL && if (ci->progeny[k] != NULL &&
((ci->progeny[k]->stars.count != 0 && ci->progeny[j]->hydro.count != 0) || ((ci->progeny[k]->stars.count != 0 &&
(ci->progeny[j]->stars.count != 0 && ci->progeny[k]->hydro.count != 0))) ci->progeny[j]->hydro.count != 0) ||
(ci->progeny[j]->stars.count != 0 &&
ci->progeny[k]->hydro.count != 0)))
scheduler_splittask_stars( scheduler_splittask_stars(
scheduler_addtask(s, task_type_pair, t->subtype, scheduler_addtask(s, task_type_pair, t->subtype,
sub_sid_flag[j][k], 0, ci->progeny[j], sub_sid_flag[j][k], 0, ci->progeny[j],
...@@ -1132,14 +1134,14 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) { ...@@ -1132,14 +1134,14 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) {
cell_can_split_pair_stars_task(cj, ci)) { cell_can_split_pair_stars_task(cj, ci)) {
/* Replace by a single sub-task? */ /* Replace by a single sub-task? */
if (scheduler_dosub && /* Use division to avoid integer overflow. */ if (scheduler_dosub && /* Use division to avoid integer overflow. */
ci->hydro.count * sid_scale[sid] < ci->hydro.count * sid_scale[sid] <
space_subsize_pair_hydro / cj->hydro.count && space_subsize_pair_hydro / cj->hydro.count &&
!sort_is_corner(sid)) { !sort_is_corner(sid)) {
/* Make this task a sub task. */ /* Make this task a sub task. */
t->type = task_type_sub_pair; t->type = task_type_sub_pair;
/* Otherwise, split it. */ /* Otherwise, split it. */
} else { } else {
/* Take a step back (we're going to recycle the current task)... */ /* Take a step back (we're going to recycle the current task)... */
......
...@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static void stars_init_spart( ...@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static void stars_init_spart(
* @param dt_drift The drift time-step for positions. * @param dt_drift The drift time-step for positions.
*/ */
__attribute__((always_inline)) INLINE static void stars_predict_extra( __attribute__((always_inline)) INLINE static void stars_predict_extra(
struct spart *restrict sp, float dt_drift) { struct spart* restrict sp, float dt_drift) {
const float h_inv = 1.f / sp->h; const float h_inv = 1.f / sp->h;