Commit db8c453d authored by Matthieu Schaller's avatar Matthieu Schaller

Merge branch 'improve_unskip' into 'master'

Improve unskip by escaping early

See merge request swift/swiftsim!528
parents b30f76d2 4771e9a3
......@@ -1221,6 +1221,12 @@ void cell_make_multipoles(struct cell *c, integertime_t ti_current) {
if (c->split) {
/* Start by recursing */
for (int k = 0; k < 8; ++k) {
if (c->progeny[k] != NULL)
cell_make_multipoles(c->progeny[k], ti_current);
}
/* Compute CoM of all progenies */
double CoM[3] = {0., 0., 0.};
double mass = 0.;
......@@ -1234,9 +1240,11 @@ void cell_make_multipoles(struct cell *c, integertime_t ti_current) {
mass += m->m_pole.M_000;
}
}
c->multipole->CoM[0] = CoM[0] / mass;
c->multipole->CoM[1] = CoM[1] / mass;
c->multipole->CoM[2] = CoM[2] / mass;
const double mass_inv = 1. / mass;
c->multipole->CoM[0] = CoM[0] * mass_inv;
c->multipole->CoM[1] = CoM[1] * mass_inv;
c->multipole->CoM[2] = CoM[2] * mass_inv;
/* Now shift progeny multipoles and add them up */
struct multipole temp;
......@@ -1259,13 +1267,13 @@ void cell_make_multipoles(struct cell *c, integertime_t ti_current) {
}
}
/* Alternative upper limit of max CoM<->gpart distance */
const double dx = c->multipole->CoM[0] > c->loc[0] + c->width[0] / 2.
const double dx = c->multipole->CoM[0] > c->loc[0] + c->width[0] * 0.5
? c->multipole->CoM[0] - c->loc[0]
: c->loc[0] + c->width[0] - c->multipole->CoM[0];
const double dy = c->multipole->CoM[1] > c->loc[1] + c->width[1] / 2.
const double dy = c->multipole->CoM[1] > c->loc[1] + c->width[1] * 0.5
? c->multipole->CoM[1] - c->loc[1]
: c->loc[1] + c->width[1] - c->multipole->CoM[1];
const double dz = c->multipole->CoM[2] > c->loc[2] + c->width[2] / 2.
const double dz = c->multipole->CoM[2] > c->loc[2] + c->width[2] * 0.5
? c->multipole->CoM[2] - c->loc[2]
: c->loc[2] + c->width[2] - c->multipole->CoM[2];
......@@ -1276,25 +1284,31 @@ void cell_make_multipoles(struct cell *c, integertime_t ti_current) {
if (c->gcount > 0) {
gravity_P2M(c->multipole, c->gparts, c->gcount);
const double dx = c->multipole->CoM[0] > c->loc[0] + c->width[0] / 2.
const double dx = c->multipole->CoM[0] > c->loc[0] + c->width[0] * 0.5
? c->multipole->CoM[0] - c->loc[0]
: c->loc[0] + c->width[0] - c->multipole->CoM[0];
const double dy = c->multipole->CoM[1] > c->loc[1] + c->width[1] / 2.
const double dy = c->multipole->CoM[1] > c->loc[1] + c->width[1] * 0.5
? c->multipole->CoM[1] - c->loc[1]
: c->loc[1] + c->width[1] - c->multipole->CoM[1];
const double dz = c->multipole->CoM[2] > c->loc[2] + c->width[2] / 2.
const double dz = c->multipole->CoM[2] > c->loc[2] + c->width[2] * 0.5
? c->multipole->CoM[2] - c->loc[2]
: c->loc[2] + c->width[2] - c->multipole->CoM[2];
c->multipole->r_max = sqrt(dx * dx + dy * dy + dz * dz);
} else {
gravity_multipole_init(&c->multipole->m_pole);
c->multipole->CoM[0] = c->loc[0] + c->width[0] / 2.;
c->multipole->CoM[1] = c->loc[1] + c->width[1] / 2.;
c->multipole->CoM[2] = c->loc[2] + c->width[2] / 2.;
c->multipole->CoM[0] = c->loc[0] + c->width[0] * 0.5;
c->multipole->CoM[1] = c->loc[1] + c->width[1] * 0.5;
c->multipole->CoM[2] = c->loc[2] + c->width[2] * 0.5;
c->multipole->r_max = 0.;
}
}
/* Also update the values at rebuild time */
c->multipole->r_max_rebuild = c->multipole->r_max;
c->multipole->CoM_rebuild[0] = c->multipole->CoM[0];
c->multipole->CoM_rebuild[1] = c->multipole->CoM[1];
c->multipole->CoM_rebuild[2] = c->multipole->CoM[2];
c->ti_old_multipole = ti_current;
}
......@@ -1436,10 +1450,12 @@ void cell_activate_drift_gpart(struct cell *c, struct scheduler *s) {
* @brief Activate the sorts up a cell hierarchy.
*/
void cell_activate_sorts_up(struct cell *c, struct scheduler *s) {
if (c == c->super_hydro) {
scheduler_activate(s, c->sorts);
if (c->nodeID == engine_rank) cell_activate_drift_part(c, s);
} else {
for (struct cell *parent = c->parent;
parent != NULL && !parent->do_sub_sort; parent = parent->parent) {
parent->do_sub_sort = 1;
......@@ -1500,8 +1516,9 @@ void cell_activate_subcell_hydro_tasks(struct cell *ci, struct cell *cj,
/* Self interaction? */
if (cj == NULL) {
/* Do anything? */
if (!cell_is_active_hydro(ci, e)) return;
if (ci->count == 0 || !cell_is_active_hydro(ci, e)) return;
/* Recurse? */
if (cell_can_recurse_in_self_task(ci)) {
......@@ -1523,239 +1540,318 @@ void cell_activate_subcell_hydro_tasks(struct cell *ci, struct cell *cj,
}
}
/* Otherwise, pair interation, recurse? */
else if (cell_can_recurse_in_pair_task(ci) &&
cell_can_recurse_in_pair_task(cj)) {
/* Otherwise, pair interation */
else {
/* Should we even bother? */
if (!cell_is_active_hydro(ci, e) && !cell_is_active_hydro(cj, e)) return;
if (ci->count == 0 || cj->count == 0) return;
/* Get the type of pair if not specified explicitly. */
/* Get the orientation of the pair. */
double shift[3];
int sid = space_getsid(s->space, &ci, &cj, shift);
/* Different types of flags. */
switch (sid) {
/* 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_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_hydro_tasks(ci->progeny[6], cj->progeny[0], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
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_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_hydro_tasks(ci->progeny[5], cj->progeny[0], s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
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_hydro_tasks(ci->progeny[4], cj->progeny[0], s);
if (ci->progeny[4] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[1], s);
if (ci->progeny[4] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[2], s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3], s);
if (ci->progeny[5] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[0], s);
if (ci->progeny[5] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[1], s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
if (ci->progeny[5] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[3], s);
if (ci->progeny[6] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[0], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[6] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[2], s);
if (ci->progeny[6] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[3], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[1], s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[2], s);
if (ci->progeny[7] != NULL && cj->progeny[3] != NULL)
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_hydro_tasks(ci->progeny[4], cj->progeny[1], s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[6] != NULL && cj->progeny[3] != NULL)
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_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_hydro_tasks(ci->progeny[4], cj->progeny[2], s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3], s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
if (ci->progeny[5] != NULL && cj->progeny[3] != NULL)
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_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_hydro_tasks(ci->progeny[3], cj->progeny[0], s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
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_hydro_tasks(ci->progeny[2], cj->progeny[0], s);
if (ci->progeny[2] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[1], s);
if (ci->progeny[2] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[4], s);
if (ci->progeny[2] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[5], s);
if (ci->progeny[3] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[0], s);
if (ci->progeny[3] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[1], s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4], s);
if (ci->progeny[3] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[5], s);
if (ci->progeny[6] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[0], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[6] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[4], s);
if (ci->progeny[6] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[5], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[1], s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[4], s);
if (ci->progeny[7] != NULL && cj->progeny[5] != NULL)
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_hydro_tasks(ci->progeny[2], cj->progeny[1], s);
if (ci->progeny[2] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[5], s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1], s);
if (ci->progeny[6] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[5], s);
break;
/* recurse? */
if (cell_can_recurse_in_pair_task(ci) &&
cell_can_recurse_in_pair_task(cj)) {
/* Different types of flags. */
switch (sid) {
/* 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_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_hydro_tasks(ci->progeny[6], cj->progeny[0],
s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1],
s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0],
s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
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_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_hydro_tasks(ci->progeny[5], cj->progeny[0],
s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2],
s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0],
s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
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_hydro_tasks(ci->progeny[4], cj->progeny[0],
s);
if (ci->progeny[4] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[1],
s);
if (ci->progeny[4] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[2],
s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3],
s);
if (ci->progeny[5] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[0],
s);
if (ci->progeny[5] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[1],
s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2],
s);
if (ci->progeny[5] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[3],
s);
if (ci->progeny[6] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[0],
s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1],
s);
if (ci->progeny[6] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[2],
s);
if (ci->progeny[6] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[3],
s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0],
s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[1],
s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[2],
s);
if (ci->progeny[7] != NULL && cj->progeny[3] != NULL)
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_hydro_tasks(ci->progeny[4], cj->progeny[1],
s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3],
s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1],
s);
if (ci->progeny[6] != NULL && cj->progeny[3] != NULL)
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_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_hydro_tasks(ci->progeny[4], cj->progeny[2],
s);
if (ci->progeny[4] != NULL && cj->progeny[3] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[4], cj->progeny[3],
s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2],
s);
if (ci->progeny[5] != NULL && cj->progeny[3] != NULL)
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_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_hydro_tasks(ci->progeny[3], cj->progeny[0],
s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4],
s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0],
s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
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_hydro_tasks(ci->progeny[2], cj->progeny[0],
s);
if (ci->progeny[2] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[1],
s);
if (ci->progeny[2] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[4],
s);
if (ci->progeny[2] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[5],
s);
if (ci->progeny[3] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[0],
s);
if (ci->progeny[3] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[1],
s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4],
s);
if (ci->progeny[3] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[5],
s);
if (ci->progeny[6] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[0],
s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1],
s);
if (ci->progeny[6] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[4],
s);
if (ci->progeny[6] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[5],
s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0],
s);
if (ci->progeny[7] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[1],
s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[4],
s);
if (ci->progeny[7] != NULL && cj->progeny[5] != NULL)
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_hydro_tasks(ci->progeny[2], cj->progeny[1],
s);
if (ci->progeny[2] != NULL && cj->progeny[5] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[2], cj->progeny[5],
s);
if (ci->progeny[6] != NULL && cj->progeny[1] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[6], cj->progeny[1],
s);
if (ci->progeny[6] != NULL && cj->progeny[5] != NULL)
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_hydro_tasks(ci->progeny[1], cj->progeny[0],
s);
if (ci->progeny[1] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[2],
s);
if (ci->progeny[1] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[4],
s);
if (ci->progeny[1] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[6],
s);
if (ci->progeny[3] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[0],
s);
if (ci->progeny[3] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[2],
s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4],
s);
if (ci->progeny[3] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[6],
s);
if (ci->progeny[5] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[0],
s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2],
s);
if (ci->progeny[5] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[4],
s);
if (ci->progeny[5] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[6],
s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0],
s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[2],
s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[4],
s);
if (ci->progeny[7] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[6],
s);
break;
}
case 12: /* ( 0 , 0 , 1 ) */
if (ci->progeny[1] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[0], s);
if (ci->progeny[1] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[2], s);
if (ci->progeny[1] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[4], s);
if (ci->progeny[1] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[1], cj->progeny[6], s);
if (ci->progeny[3] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[0], s);
if (ci->progeny[3] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[2], s);
if (ci->progeny[3] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[4], s);
if (ci->progeny[3] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[3], cj->progeny[6], s);
if (ci->progeny[5] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[0], s);
if (ci->progeny[5] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[2], s);
if (ci->progeny[5] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[4], s);
if (ci->progeny[5] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[5], cj->progeny[6], s);
if (ci->progeny[7] != NULL && cj->progeny[0] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[0], s);
if (ci->progeny[7] != NULL && cj->progeny[2] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[2], s);
if (ci->progeny[7] != NULL && cj->progeny[4] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[4], s);
if (ci->progeny[7] != NULL && cj->progeny[6] != NULL)
cell_activate_subcell_hydro_tasks(ci->progeny[7], cj->progeny[6], s);
break;
}
}
/* Otherwise, activate the sorts and drifts. */
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];
int sid = space_getsid(s->space, &ci, &cj, shift);
/* Otherwise, activate the sorts and drifts. */
else if (cell_is_active_hydro(ci, e) || cell_is_active_hydro(cj, e)) {
/* We are going to interact this pair, so store some values. */
atomic_or(&ci->requires_sorts, 1 << sid);
atomic_or(&cj->requires_sorts, 1 << sid);
ci->dx_max_sort_old = ci->dx_max_sort;
cj->dx_max_sort_old = cj->dx_max_sort;
/* We are going to interact this pair, so store some values. */
atomic_or(&ci->requires_sorts, 1 << sid);
atomic_or(&cj->requires_sorts, 1 << sid);
ci->dx_max_sort_old = ci->dx_max_sort;
cj->dx_max_sort_old = cj->dx_max_sort;
/* Activate the drifts if the cells are local. */
if (ci->nodeID == engine_rank) cell_activate_drift_part(ci, s);
if (cj->nodeID == engine_rank) cell_activate_drift_part(cj, s);
/* Activate the drifts if the cells are local. */
if (ci->nodeID == engine_rank) cell_activate_drift_part(ci, s);
if (cj->nodeID == engine_rank) cell_activate_drift_part(cj, s);
/* Do we need to sort the cells? */
cell_activate_sorts(ci, sid, s);
cell_activate_sorts(cj, sid, s);
}
/* Do we need to sort the cells? */
cell_activate_sorts(ci, sid, s);
cell_activate_sorts(cj, sid, s);
}
} /* Otherwise, pair interation */
}
/**
* @brief Traverse a sub-cell task and activate the gravity drift tasks that are
* required
* by a self gravity task.
* @brief Traverse a sub-cell task and activate the gravity drift tasks that