Commit c6e29dd8 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Separate the time-step information for hydro and gravity tasks into two...

Separate the time-step information for hydro and gravity tasks into two different set of variables for each cell.
parent 5048bd16
......@@ -82,19 +82,19 @@ __attribute__((always_inline)) INLINE static int cell_are_gpart_drifted(
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int cell_is_active(
__attribute__((always_inline)) INLINE static int cell_is_active_hydro(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->ti_end_min < e->ti_current)
if (c->ti_hydro_end_min < e->ti_current)
error(
"cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and "
"e->ti_current=%lld (t=%e)",
c->ti_end_min, c->ti_end_min * e->timeBase, e->ti_current,
c->ti_hydro_end_min, c->ti_hydro_end_min * e->timeBase, e->ti_current,
e->ti_current * e->timeBase);
#endif
return (c->ti_end_min == e->ti_current);
return (c->ti_hydro_end_min == e->ti_current);
}
/**
......@@ -104,18 +104,61 @@ __attribute__((always_inline)) INLINE static int cell_is_active(
* @param e The #engine containing information about the current time.
* @return 1 if all particles in a #cell are active, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int cell_is_all_active(
__attribute__((always_inline)) INLINE static int cell_is_all_active_hydro(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->ti_end_max < e->ti_current)
if (c->ti_hydro_end_max < e->ti_current)
error(
"cell in an impossible time-zone! c->ti_end_max=%lld "
"e->ti_current=%lld",
c->ti_end_max, e->ti_current);
c->ti_hydro_end_max, e->ti_current);
#endif
return (c->ti_end_max == e->ti_current);
return (c->ti_hydro_end_max == e->ti_current);
}
/**
* @brief Does a cell contain any g-particle finishing their time-step now ?
*
* @param c The #cell.
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int cell_is_active_gravity(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->ti_gravity_end_min < e->ti_current)
error(
"cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and "
"e->ti_current=%lld (t=%e)",
c->ti_gravity_end_min, c->ti_gravity_end_min * e->timeBase,
e->ti_current, e->ti_current * e->timeBase);
#endif
return (c->ti_gravity_end_min == e->ti_current);
}
/**
* @brief Are *all* g-particles in a cell finishing their time-step now ?
*
* @param c The #cell.
* @param e The #engine containing information about the current time.
* @return 1 if all particles in a #cell are active, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int cell_is_all_active_gravity(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->ti_gravity_end_max < e->ti_current)
error(
"cell in an impossible time-zone! c->ti_end_max=%lld "
"e->ti_current=%lld",
c->ti_gravity_end_max, e->ti_current);
#endif
return (c->ti_gravity_end_max == e->ti_current);
}
/**
......@@ -215,19 +258,41 @@ __attribute__((always_inline)) INLINE static int spart_is_active(
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int cell_is_starting(
__attribute__((always_inline)) INLINE static int cell_is_starting_hydro(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->ti_beg_max > e->ti_current)
if (c->ti_hydro_beg_max > e->ti_current)
error(
"cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and "
"e->ti_current=%lld (t=%e)",
c->ti_beg_max, c->ti_beg_max * e->timeBase, e->ti_current,
c->ti_hydro_beg_max, c->ti_hydro_beg_max * e->timeBase, e->ti_current,
e->ti_current * e->timeBase);
#endif
return (c->ti_beg_max == e->ti_current);
return (c->ti_hydro_beg_max == e->ti_current);
}
/**
* @brief Does a cell contain any g-particle starting their time-step now ?
*
* @param c The #cell.
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int cell_is_starting_gravity(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->ti_gravity_beg_max > e->ti_current)
error(
"cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and "
"e->ti_current=%lld (t=%e)",
c->ti_gravity_beg_max, c->ti_gravity_beg_max * e->timeBase,
e->ti_current, e->ti_current * e->timeBase);
#endif
return (c->ti_gravity_beg_max == e->ti_current);
}
/**
......
......@@ -173,8 +173,10 @@ int cell_pack(struct cell *restrict c, struct pcell *restrict pc) {
/* Start by packing the data of the current cell. */
pc->h_max = c->h_max;
pc->ti_end_min = c->ti_end_min;
pc->ti_end_max = c->ti_end_max;
pc->ti_hydro_end_min = c->ti_hydro_end_min;
pc->ti_hydro_end_max = c->ti_hydro_end_max;
pc->ti_gravity_end_min = c->ti_gravity_end_min;
pc->ti_gravity_end_max = c->ti_gravity_end_max;
pc->ti_old_part = c->ti_old_part;
pc->ti_old_gpart = c->ti_old_gpart;
pc->ti_old_multipole = c->ti_old_multipole;
......@@ -221,8 +223,10 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
/* Unpack the current pcell. */
c->h_max = pc->h_max;
c->ti_end_min = pc->ti_end_min;
c->ti_end_max = pc->ti_end_max;
c->ti_hydro_end_min = pc->ti_hydro_end_min;
c->ti_hydro_end_max = pc->ti_hydro_end_max;
c->ti_gravity_end_min = pc->ti_gravity_end_min;
c->ti_gravity_end_max = pc->ti_gravity_end_max;
c->ti_old_part = pc->ti_old_part;
c->ti_old_gpart = pc->ti_old_gpart;
c->ti_old_multipole = pc->ti_old_multipole;
......@@ -291,7 +295,8 @@ int cell_pack_end_step(struct cell *restrict c,
#ifdef WITH_MPI
/* Pack this cell's data. */
pcells[0].ti_end_min = c->ti_end_min;
pcells[0].ti_hydro_end_min = c->ti_hydro_end_min;
pcells[0].ti_gravity_end_min = c->ti_gravity_end_min;
pcells[0].dx_max_part = c->dx_max_part;
pcells[0].dx_max_gpart = c->dx_max_gpart;
......@@ -325,7 +330,8 @@ int cell_unpack_end_step(struct cell *restrict c,
#ifdef WITH_MPI
/* Unpack this cell's data. */
c->ti_end_min = pcells[0].ti_end_min;
c->ti_hydro_end_min = pcells[0].ti_hydro_end_min;
c->ti_gravity_end_min = pcells[0].ti_gravity_end_min;
c->dx_max_part = pcells[0].dx_max_part;
c->dx_max_gpart = pcells[0].dx_max_gpart;
......@@ -1487,8 +1493,8 @@ void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s) {
* @param cj The second #cell we recurse in.
* @param s The task #scheduler.
*/
void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s) {
void cell_activate_subcell_hydro_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s) {
const struct engine *e = s->space->e;
/* Store the current dx_max and h_max values. */
......@@ -1502,7 +1508,7 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
/* Self interaction? */
if (cj == NULL) {
/* Do anything? */
if (!cell_is_active(ci, e)) return;
if (!cell_is_active_hydro(ci, e)) return;
/* Recurse? */
if (cell_can_recurse_in_self_task(ci)) {
......@@ -1510,10 +1516,11 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
/* Loop over all progenies and pairs of progenies */
for (int j = 0; j < 8; j++) {
if (ci->progeny[j] != NULL) {
cell_activate_subcell_tasks(ci->progeny[j], NULL, s);
cell_activate_subcell_hydro_tasks(ci->progeny[j], NULL, s);
for (int k = j + 1; k < 8; k++)
if (ci->progeny[k] != NULL)
cell_activate_subcell_tasks(ci->progeny[j], ci->progeny[k], s);
cell_activate_subcell_hydro_tasks(ci->progeny[j], ci->progeny[k],
s);
}
}
} else {
......@@ -1537,200 +1544,200 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
/* Regular sub-cell interactions of a single cell. */
case 0: /* ( 1 , 1 , 1 ) */
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
break;
case 1: /* ( 1 , 1 , 0 ) */
if (ci->progeny[6] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[0], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[1], s);
break;
case 2: /* ( 1 , 1 , -1 ) */
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
break;
case 3: /* ( 1 , 0 , 1 ) */
if (ci->progeny[5] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[0], s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[2], s);
break;
case 4: /* ( 1 , 0 , 0 ) */
if (ci->progeny[4] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[0], s);
if (ci->progeny[4] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[1], s);
if (ci->progeny[4] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[2], s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3], s);
if (ci->progeny[5] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[0], s);
if (ci->progeny[5] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[1], s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
if (ci->progeny[5] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[3], s);
if (ci->progeny[6] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[0], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[6] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[2], s);
if (ci->progeny[6] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[3], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[1], s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[2], s);
if (ci->progeny[7] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[3], s);
break;
case 5: /* ( 1 , 0 , -1 ) */
if (ci->progeny[4] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[1], s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[6] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[3], s);
break;
case 6: /* ( 1 , -1 , 1 ) */
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
break;
case 7: /* ( 1 , -1 , 0 ) */
if (ci->progeny[4] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[2], s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3], s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
if (ci->progeny[5] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[3], s);
break;
case 8: /* ( 1 , -1 , -1 ) */
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_tasks(ci->progeny[4], cj->progeny[3], s);
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3], s);
break;
case 9: /* ( 0 , 1 , 1 ) */
if (ci->progeny[3] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[0], s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[4], s);
break;
case 10: /* ( 0 , 1 , 0 ) */
if (ci->progeny[2] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[2], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[0], s);
if (ci->progeny[2] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[2], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[1], s);
if (ci->progeny[2] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[2], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[4], s);
if (ci->progeny[2] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_tasks(ci->progeny[2], cj->progeny[5], s);
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[5], s);
if (ci->progeny[3] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[0], s);
if (ci->progeny[3] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[1], s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4], s);
if (ci->progeny[3] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[5], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[5], s);
if (ci->progeny[6] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[0], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[6] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[4], s);
if (ci->progeny[6] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[5], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[5], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[1], s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[4], s);
if (ci->progeny[7] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[5], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[5], s);
break;
case 11: /* ( 0 , 1 , -1 ) */
if (ci->progeny[2] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[2], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[1], s);
if (ci->progeny[2] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_tasks(ci->progeny[2], cj->progeny[5], s);
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[5], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[1], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[6] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_tasks(ci->progeny[6], cj->progeny[5], s);
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[5], s);
break;
case 12: /* ( 0 , 0 , 1 ) */
if (ci->progeny[1] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[1], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[0], s);
if (ci->progeny[1] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[1], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[2], s);
if (ci->progeny[1] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[1], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[4], s);
if (ci->progeny[1] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_tasks(ci->progeny[1], cj->progeny[6], s);
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[6], s);
if (ci->progeny[3] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[0], s);
if (ci->progeny[3] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[2], s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4], s);
if (ci->progeny[3] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_tasks(ci->progeny[3], cj->progeny[6], s);
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[6], s);
if (ci->progeny[5] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[0], s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
if (ci->progeny[5] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[4], s);
if (ci->progeny[5] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_tasks(ci->progeny[5], cj->progeny[6], s);
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[6], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[0], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[2], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[2], s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[4], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[4], s);
if (ci->progeny[7] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_tasks(ci->progeny[7], cj->progeny[6], s);
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[6], s);
break;
}
}
/* Otherwise, activate the sorts and drifts. */
else if (cell_is_active(ci, e) || cell_is_active(cj, e)) {
else if (cell_is_active_hydro(ci, e) || cell_is_active_hydro(cj, e)) {
/* Get the type of pair if not specified explicitly. */
double shift[3];
......@@ -1774,7 +1781,7 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
if (cj == NULL) {
/* Do anything? */
if (!cell_is_active(ci, e)) return;
if (!cell_is_active_gravity(ci, e)) return;
/* Recurse? */
if (ci->split) {
......@@ -1800,7 +1807,8 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
else {
/* Anything to do here? */
if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return;
if (!cell_is_active_gravity(ci, e) && !cell_is_active_gravity(cj, e))
return;
if (ci->ti_old_multipole < e->ti_current) cell_drift_multipole(ci, e);
if (cj->ti_old_multipole < e->ti_current) cell_drift_multipole(cj, e);
......@@ -1834,7 +1842,7 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
else if (!ci->split && !cj->split) {
/* Activate the drifts if the cells are local. */
if (cell_is_active(ci, e) || cell_is_active(cj, e)) {
if (cell_is_active_gravity(ci, e) || cell_is_active_gravity(cj, e)) {
if (ci->nodeID == engine_rank) cell_activate_drift_gpart(ci, s);
if (cj->nodeID == engine_rank) cell_activate_drift_gpart(cj, s);
}
......@@ -1903,7 +1911,7 @@ void cell_activate_subcell_external_grav_tasks(struct cell *ci,
const struct engine *e = sp->e;
/* Do anything? */
if (!cell_is_active(ci, e)) return;
if (!cell_is_active_gravity(ci, e)) return;
/* Recurse? */
if (ci->split) {
......@@ -1922,7 +1930,7 @@ void cell_activate_subcell_external_grav_tasks(struct cell *ci,
}
/**
* @brief Un-skips all the tasks associated with a given cell and checks
* @brief Un-skips all the hydro tasks associated with a given cell and checks
* if the space needs to be rebuilt.
*
* @param c the #cell.
......@@ -1930,7 +1938,7 @@ void cell_activate_subcell_external_grav_tasks(struct cell *ci,
*
* @return 1 If the space needs rebuilding. 0 otherwise.
*/
int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
struct engine *e = s->space->e;
const int nodeID = e->nodeID;
......@@ -1941,8 +1949,8 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
struct task *t = l->t;
struct cell *ci = t->ci;
struct cell *cj = t->cj;
const int ci_active = cell_is_active(ci, e);
const int cj_active = (cj != NULL) ? cell_is_active(cj, e) : 0;
const int ci_active = cell_is_active_hydro(ci, e);
const int cj_active = (cj != NULL) ? cell_is_active_hydro(cj, e) : 0;
/* Only activate tasks that involve a local active cell. */
if ((ci_active && ci->nodeID == nodeID) ||
......@@ -1972,7 +1980,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
}
/* Store current values of dx_max and h_max. */
else if (t->type == task_type_sub_pair || t->type == task_type_sub_self) {
cell_activate_subcell_tasks(t->ci, t->cj, s);
cell_activate_subcell_hydro_tasks(t->ci, t->cj, s);
}
}
......@@ -2068,13 +2076,50 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
}
}
/* Unskip all the other task types. */
if (c->nodeID == nodeID && cell_is_active_hydro(c, e)) {
for (struct link *l = c->gradient; l != NULL; l = l->next)
scheduler_activate(s, l->t);
for (struct link *l = c->force; l != NULL; l = l->next)
scheduler_activate(s, l->t);