Commit 3d63d354 authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Update cell.h with required modifications

parent 9470da94
......@@ -1096,10 +1096,10 @@ int main(int argc, char *argv[]) {
? e.sched.tasks[l].cj->hydro.count
: 0,
(e.sched.tasks[l].ci != NULL)
? e.sched.tasks[l].ci->grav.gcount
? e.sched.tasks[l].ci->grav.count
: 0,
(e.sched.tasks[l].cj != NULL)
? e.sched.tasks[l].cj->grav.gcount
? e.sched.tasks[l].cj->grav.count
: 0,
e.sched.tasks[l].flags, e.sched.tasks[l].sid);
}
......@@ -1134,9 +1134,9 @@ int main(int argc, char *argv[]) {
(e.sched.tasks[l].cj == NULL) ? 0
: e.sched.tasks[l].cj->hydro.count,
(e.sched.tasks[l].ci == NULL) ? 0
: e.sched.tasks[l].ci->grav.gcount,
: e.sched.tasks[l].ci->grav.count,
(e.sched.tasks[l].cj == NULL) ? 0
: e.sched.tasks[l].cj->grav.gcount,
: e.sched.tasks[l].cj->grav.count,
e.sched.tasks[l].sid);
}
}
......
......@@ -39,15 +39,16 @@ __attribute__((always_inline)) INLINE static int cell_are_part_drifted(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->hydro.ti_old > e->ti_current)
if (c->hydro.ti_old_part > e->ti_current)
error(
"Cell has been drifted too far forward in time! c->ti_old=%lld (t=%e) "
"Cell has been drifted too far forward in time! c->ti_old_part=%lld "
"(t=%e) "
"and e->ti_current=%lld (t=%e, a=%e)",
c->hydro.ti_old, c->hydro.ti_old * e->time_base, e->ti_current,
e->ti_current * e->time_base, e->cosmology->a);
c->hydro.ti_old_part, c->hydro.ti_old_part * e->time_base,
e->ti_current, e->ti_current * e->time_base, e->cosmology->a);
#endif
return (c->hydro.ti_old == e->ti_current);
return (c->hydro.ti_old_part == e->ti_current);
}
/**
......@@ -62,15 +63,15 @@ __attribute__((always_inline)) INLINE static int cell_are_gpart_drifted(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->grav.ti_old_gpart > e->ti_current)
if (c->grav.ti_old_part > e->ti_current)
error(
"Cell has been drifted too far forward in time! c->ti_old=%lld (t=%e) "
"and e->ti_current=%lld (t=%e)",
c->grav.ti_old_gpart, c->grav.ti_old_gpart * e->time_base,
e->ti_current, e->ti_current * e->time_base);
c->grav.ti_old_part, c->grav.ti_old_part * e->time_base, e->ti_current,
e->ti_current * e->time_base);
#endif
return (c->grav.ti_old_gpart == e->ti_current);
return (c->grav.ti_old_part == e->ti_current);
}
/* Are cells / particles active for regular tasks ? */
......
......@@ -278,7 +278,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subset(
/* Pad cache with fake particles that exist outside the cell so will not
* interact. We use values of the same magnitude (but negative!) as the real
* particles to avoid overflow problems. */
const double max_dx = ci->hydro.dx_max;
const double max_dx = ci->hydro.dx_max_part;
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx),
-(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
......@@ -326,7 +326,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subset(
/* Pad cache with fake particles that exist outside the cell so will not
* interact. We use values of the same magnitude (but negative!) as the real
* particles to avoid overflow problems. */
const double max_dx = ci->hydro.dx_max;
const double max_dx = ci->hydro.dx_max_part;
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx),
-(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
......@@ -491,11 +491,14 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
#ifdef SWIFT_DEBUG_CHECKS
const float shift_threshold_x =
2. * ci->width[0] + 2. * max(ci->hydro.dx_max, cj->hydro.dx_max);
2. * ci->width[0] +
2. * max(ci->hydro.dx_max_part, cj->hydro.dx_max_part);
const float shift_threshold_y =
2. * ci->width[1] + 2. * max(ci->hydro.dx_max, cj->hydro.dx_max);
2. * ci->width[1] +
2. * max(ci->hydro.dx_max_part, cj->hydro.dx_max_part);
const float shift_threshold_z =
2. * ci->width[2] + 2. * max(ci->hydro.dx_max, cj->hydro.dx_max);
2. * ci->width[2] +
2. * max(ci->hydro.dx_max_part, cj->hydro.dx_max_part);
/* Make sure that particle positions have been shifted correctly. */
for (int i = 0; i < ci_cache_count; i++) {
......@@ -529,7 +532,7 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
/* Pad cache with fake particles that exist outside the cell so will not
* interact. We use values of the same magnitude (but negative!) as the real
* particles to avoid overflow problems. */
const double max_dx = max(ci->hydro.dx_max, cj->hydro.dx_max);
const double max_dx = max(ci->hydro.dx_max_part, cj->hydro.dx_max_part);
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx),
-(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
......@@ -723,7 +726,7 @@ cache_read_two_partial_cells_sorted_force(
/* Pad cache with fake particles that exist outside the cell so will not
* interact. We use values of the same magnitude (but negative!) as the real
* particles to avoid overflow problems. */
const double max_dx = max(ci->hydro.dx_max, cj->hydro.dx_max);
const double max_dx = max(ci->hydro.dx_max_part, cj->hydro.dx_max_part);
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx),
-(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
......
......@@ -122,7 +122,7 @@ int cell_link_parts(struct cell *c, struct part *parts) {
*/
int cell_link_gparts(struct cell *c, struct gpart *gparts) {
c->grav.gparts = gparts;
c->grav.parts = gparts;
/* Fill the progeny recursively, depth-first. */
if (c->split) {
......@@ -134,7 +134,7 @@ int cell_link_gparts(struct cell *c, struct gpart *gparts) {
}
/* Return the total number of linked particles. */
return c->grav.gcount;
return c->grav.count;
}
/**
......@@ -147,7 +147,7 @@ int cell_link_gparts(struct cell *c, struct gpart *gparts) {
*/
int cell_link_sparts(struct cell *c, struct spart *sparts) {
c->sparts = sparts;
c->stars.parts = sparts;
/* Fill the progeny recursively, depth-first. */
if (c->split) {
......@@ -159,7 +159,7 @@ int cell_link_sparts(struct cell *c, struct spart *sparts) {
}
/* Return the total number of linked particles. */
return c->scount;
return c->stars.count;
}
/**
......@@ -184,12 +184,12 @@ int cell_pack(struct cell *restrict c, struct pcell *restrict pc,
pc->hydro.ti_end_max = c->hydro.ti_end_max;
pc->grav.ti_end_min = c->grav.ti_end_min;
pc->grav.ti_end_max = c->grav.ti_end_max;
pc->hydro.ti_old = c->hydro.ti_old;
pc->grav.ti_old_gpart = c->grav.ti_old_gpart;
pc->hydro.ti_old_part = c->hydro.ti_old_part;
pc->grav.ti_old_part = c->grav.ti_old_part;
pc->grav.ti_old_multipole = c->grav.ti_old_multipole;
pc->hydro.count = c->hydro.count;
pc->grav.gcount = c->grav.gcount;
pc->scount = c->scount;
pc->grav.count = c->grav.count;
pc->stars.count = c->stars.count;
/* Copy the Multipole related information */
if (with_gravity) {
......@@ -286,12 +286,12 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
c->hydro.ti_end_max = pc->hydro.ti_end_max;
c->grav.ti_end_min = pc->grav.ti_end_min;
c->grav.ti_end_max = pc->grav.ti_end_max;
c->hydro.ti_old = pc->hydro.ti_old;
c->grav.ti_old_gpart = pc->grav.ti_old_gpart;
c->hydro.ti_old_part = pc->hydro.ti_old_part;
c->grav.ti_old_part = pc->grav.ti_old_part;
c->grav.ti_old_multipole = pc->grav.ti_old_multipole;
c->hydro.count = pc->hydro.count;
c->grav.gcount = pc->grav.gcount;
c->scount = pc->scount;
c->grav.count = pc->grav.count;
c->stars.count = pc->stars.count;
#ifdef SWIFT_DEBUG_CHECKS
c->cellID = pc->cellID;
#endif
......@@ -321,8 +321,8 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
struct cell *temp;
space_getcells(s, 1, &temp);
temp->hydro.count = 0;
temp->grav.gcount = 0;
temp->scount = 0;
temp->grav.count = 0;
temp->stars.count = 0;
temp->loc[0] = c->loc[0];
temp->loc[1] = c->loc[1];
temp->loc[2] = c->loc[2];
......@@ -335,7 +335,7 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
if (k & 1) temp->loc[2] += temp->width[2];
temp->depth = c->depth + 1;
temp->split = 0;
temp->hydro.dx_max = 0.f;
temp->hydro.dx_max_part = 0.f;
temp->hydro.dx_max_sort = 0.f;
temp->nodeID = c->nodeID;
temp->parent = c;
......@@ -409,7 +409,7 @@ int cell_pack_end_step(struct cell *restrict c,
pcells[0].hydro.ti_end_max = c->hydro.ti_end_max;
pcells[0].grav.ti_end_min = c->grav.ti_end_min;
pcells[0].grav.ti_end_max = c->grav.ti_end_max;
pcells[0].hydro.dx_max = c->hydro.dx_max;
pcells[0].hydro.dx_max_part = c->hydro.dx_max_part;
/* Fill in the progeny, depth-first recursion. */
int count = 1;
......@@ -445,7 +445,7 @@ int cell_unpack_end_step(struct cell *restrict c,
c->hydro.ti_end_max = pcells[0].hydro.ti_end_max;
c->grav.ti_end_min = pcells[0].grav.ti_end_min;
c->grav.ti_end_max = pcells[0].grav.ti_end_max;
c->hydro.dx_max = pcells[0].hydro.dx_max;
c->hydro.dx_max_part = pcells[0].hydro.dx_max_part;
/* Fill in the progeny, depth-first recursion. */
int count = 1;
......@@ -603,16 +603,16 @@ int cell_glocktree(struct cell *c) {
TIMER_TIC
/* First of all, try to lock this cell. */
if (c->grav.ghold || lock_trylock(&c->grav.glock) != 0) {
if (c->grav.phold || lock_trylock(&c->grav.plock) != 0) {
TIMER_TOC(timer_locktree);
return 1;
}
/* Did somebody hold this cell in the meantime? */
if (c->grav.ghold) {
if (c->grav.phold) {
/* Unlock this cell. */
if (lock_unlock(&c->grav.glock) != 0) error("Failed to unlock cell.");
if (lock_unlock(&c->grav.plock) != 0) error("Failed to unlock cell.");
/* Admit defeat. */
TIMER_TOC(timer_locktree);
......@@ -624,13 +624,13 @@ int cell_glocktree(struct cell *c) {
for (finger = c->parent; finger != NULL; finger = finger->parent) {
/* Lock this cell. */
if (lock_trylock(&finger->grav.glock) != 0) break;
if (lock_trylock(&finger->grav.plock) != 0) break;
/* Increment the hold. */
atomic_inc(&finger->grav.ghold);
atomic_inc(&finger->grav.phold);
/* Unlock the cell. */
if (lock_unlock(&finger->grav.glock) != 0) error("Failed to unlock cell.");
if (lock_unlock(&finger->grav.plock) != 0) error("Failed to unlock cell.");
}
/* If we reached the top of the tree, we're done. */
......@@ -645,10 +645,10 @@ int cell_glocktree(struct cell *c) {
/* Undo the holds up to finger. */
for (struct cell *finger2 = c->parent; finger2 != finger;
finger2 = finger2->parent)
atomic_dec(&finger2->grav.ghold);
atomic_dec(&finger2->grav.phold);
/* Unlock this cell. */
if (lock_unlock(&c->grav.glock) != 0) error("Failed to unlock cell.");
if (lock_unlock(&c->grav.plock) != 0) error("Failed to unlock cell.");
/* Admit defeat. */
TIMER_TOC(timer_locktree);
......@@ -731,16 +731,16 @@ int cell_slocktree(struct cell *c) {
TIMER_TIC
/* First of all, try to lock this cell. */
if (c->shold || lock_trylock(&c->slock) != 0) {
if (c->stars.hold || lock_trylock(&c->stars.lock) != 0) {
TIMER_TOC(timer_locktree);
return 1;
}
/* Did somebody hold this cell in the meantime? */
if (c->shold) {
if (c->stars.hold) {
/* Unlock this cell. */
if (lock_unlock(&c->slock) != 0) error("Failed to unlock cell.");
if (lock_unlock(&c->stars.lock) != 0) error("Failed to unlock cell.");
/* Admit defeat. */
TIMER_TOC(timer_locktree);
......@@ -752,13 +752,13 @@ int cell_slocktree(struct cell *c) {
for (finger = c->parent; finger != NULL; finger = finger->parent) {
/* Lock this cell. */
if (lock_trylock(&finger->slock) != 0) break;
if (lock_trylock(&finger->stars.lock) != 0) break;
/* Increment the hold. */
atomic_inc(&finger->shold);
atomic_inc(&finger->stars.hold);
/* Unlock the cell. */
if (lock_unlock(&finger->slock) != 0) error("Failed to unlock cell.");
if (lock_unlock(&finger->stars.lock) != 0) error("Failed to unlock cell.");
}
/* If we reached the top of the tree, we're done. */
......@@ -773,10 +773,10 @@ int cell_slocktree(struct cell *c) {
/* Undo the holds up to finger. */
for (struct cell *finger2 = c->parent; finger2 != finger;
finger2 = finger2->parent)
atomic_dec(&finger2->shold);
atomic_dec(&finger2->stars.hold);
/* Unlock this cell. */
if (lock_unlock(&c->slock) != 0) error("Failed to unlock cell.");
if (lock_unlock(&c->stars.lock) != 0) error("Failed to unlock cell.");
/* Admit defeat. */
TIMER_TOC(timer_locktree);
......@@ -813,11 +813,11 @@ void cell_gunlocktree(struct cell *c) {
TIMER_TIC
/* First of all, try to unlock this cell. */
if (lock_unlock(&c->grav.glock) != 0) error("Failed to unlock cell.");
if (lock_unlock(&c->grav.plock) != 0) error("Failed to unlock cell.");
/* Climb up the tree and unhold the parents. */
for (struct cell *finger = c->parent; finger != NULL; finger = finger->parent)
atomic_dec(&finger->grav.ghold);
atomic_dec(&finger->grav.phold);
TIMER_TOC(timer_locktree);
}
......@@ -851,11 +851,11 @@ void cell_sunlocktree(struct cell *c) {
TIMER_TIC
/* First of all, try to unlock this cell. */
if (lock_unlock(&c->slock) != 0) error("Failed to unlock cell.");
if (lock_unlock(&c->stars.lock) != 0) error("Failed to unlock cell.");
/* Climb up the tree and unhold the parents. */
for (struct cell *finger = c->parent; finger != NULL; finger = finger->parent)
atomic_dec(&finger->shold);
atomic_dec(&finger->stars.hold);
TIMER_TOC(timer_locktree);
}
......@@ -867,23 +867,24 @@ void cell_sunlocktree(struct cell *c) {
* @param parts_offset Offset of the cell parts array relative to the
* space's parts array, i.e. c->hydro.parts - s->parts.
* @param sparts_offset Offset of the cell sparts array relative to the
* space's sparts array, i.e. c->sparts - s->sparts.
* @param buff A buffer with at least max(c->hydro.count, c->grav.gcount)
* space's sparts array, i.e. c->stars.parts - s->stars.parts.
* @param buff A buffer with at least max(c->hydro.count, c->grav.count)
* entries, used for sorting indices.
* @param sbuff A buffer with at least max(c->scount, c->grav.gcount) entries,
* used for sorting indices for the sparts.
* @param gbuff A buffer with at least max(c->hydro.count, c->grav.gcount)
* @param sbuff A buffer with at least max(c->stars.count, c->grav.count)
* entries, used for sorting indices for the sparts.
* @param gbuff A buffer with at least max(c->hydro.count, c->grav.count)
* entries, used for sorting indices for the gparts.
*/
void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
struct cell_buff *buff, struct cell_buff *sbuff,
struct cell_buff *gbuff) {
const int count = c->hydro.count, gcount = c->grav.gcount, scount = c->scount;
const int count = c->hydro.count, gcount = c->grav.count,
scount = c->stars.count;
struct part *parts = c->hydro.parts;
struct xpart *xparts = c->hydro.xparts;
struct gpart *gparts = c->grav.gparts;
struct spart *sparts = c->sparts;
struct gpart *gparts = c->grav.parts;
struct spart *sparts = c->stars.parts;
const double pivot[3] = {c->loc[0] + c->width[0] / 2,
c->loc[1] + c->width[1] / 2,
c->loc[2] + c->width[2] / 2};
......@@ -1075,8 +1076,8 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
/* Store the counts and offsets. */
for (int k = 0; k < 8; k++) {
c->progeny[k]->scount = bucket_count[k];
c->progeny[k]->sparts = &c->sparts[bucket_offset[k]];
c->progeny[k]->stars.count = bucket_count[k];
c->progeny[k]->stars.parts = &c->stars.parts[bucket_offset[k]];
}
/* Finally, do the same song and dance for the gparts. */
......@@ -1137,8 +1138,8 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
/* Store the counts and offsets. */
for (int k = 0; k < 8; k++) {
c->progeny[k]->grav.gcount = bucket_count[k];
c->progeny[k]->grav.gparts = &c->grav.gparts[bucket_offset[k]];
c->progeny[k]->grav.count = bucket_count[k];
c->progeny[k]->grav.parts = &c->grav.parts[bucket_offset[k]];
}
}
......@@ -1226,9 +1227,9 @@ void cell_check_part_drift_point(struct cell *c, void *data) {
/* Only check local cells */
if (c->nodeID != engine_rank) return;
if (c->hydro.ti_old != ti_drift)
if (c->hydro.ti_old_part != ti_drift)
error("Cell in an incorrect time-zone! c->hydro.ti_old=%lld ti_drift=%lld",
c->hydro.ti_old, ti_drift);
c->hydro.ti_old_part, ti_drift);
for (int i = 0; i < c->hydro.count; ++i)
if (c->hydro.parts[i].ti_drift != ti_drift)
......@@ -1257,21 +1258,21 @@ void cell_check_gpart_drift_point(struct cell *c, void *data) {
/* Only check local cells */
if (c->nodeID != engine_rank) return;
if (c->grav.ti_old_gpart != ti_drift)
if (c->grav.ti_old_part != ti_drift)
error(
"Cell in an incorrect time-zone! c->grav.ti_old_gpart=%lld "
"Cell in an incorrect time-zone! c->grav.ti_old_part=%lld "
"ti_drift=%lld",
c->grav.ti_old_gpart, ti_drift);
c->grav.ti_old_part, ti_drift);
for (int i = 0; i < c->grav.gcount; ++i)
if (c->grav.gparts[i].ti_drift != ti_drift)
for (int i = 0; i < c->grav.count; ++i)
if (c->grav.parts[i].ti_drift != ti_drift)
error("g-part in an incorrect time-zone! gp->ti_drift=%lld ti_drift=%lld",
c->grav.gparts[i].ti_drift, ti_drift);
c->grav.parts[i].ti_drift, ti_drift);
for (int i = 0; i < c->scount; ++i)
if (c->sparts[i].ti_drift != ti_drift)
for (int i = 0; i < c->stars.count; ++i)
if (c->stars.parts[i].ti_drift != ti_drift)
error("s-part in an incorrect time-zone! sp->ti_drift=%lld ti_drift=%lld",
c->sparts[i].ti_drift, ti_drift);
c->stars.parts[i].ti_drift, ti_drift);
#else
error("Calling debugging code without debugging flag activated.");
#endif
......@@ -1397,8 +1398,8 @@ void cell_make_multipoles(struct cell *c, integertime_t ti_current) {
} else {
if (c->grav.gcount > 0) {
gravity_P2M(c->grav.multipole, c->grav.gparts, c->grav.gcount);
if (c->grav.count > 0) {
gravity_P2M(c->grav.multipole, c->grav.parts, c->grav.count);
const double dx =
c->grav.multipole->CoM[0] > c->loc[0] + c->width[0] * 0.5
? c->grav.multipole->CoM[0] - c->loc[0]
......@@ -1489,10 +1490,10 @@ void cell_check_multipole(struct cell *c) {
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL) cell_check_multipole(c->progeny[k]);
if (c->grav.gcount > 0) {
if (c->grav.count > 0) {
/* Brute-force calculation */
gravity_P2M(&ma, c->grav.gparts, c->grav.gcount);
gravity_P2M(&ma, c->grav.parts, c->grav.count);
/* Now compare the multipole expansion */
if (!gravity_multipole_equal(&ma, c->grav.multipole, tolerance)) {
......@@ -1599,10 +1600,10 @@ void cell_activate_drift_gpart(struct cell *c, struct scheduler *s) {
if this has not yet been done. */
if (c == c->grav.super) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->grav.drift_gpart == NULL)
error("Trying to activate un-existing c->grav.drift_gpart");
if (c->grav.drift == NULL)
error("Trying to activate un-existing c->grav.drift");
#endif
scheduler_activate(s, c->grav.drift_gpart);
scheduler_activate(s, c->grav.drift);
} else {
for (struct cell *parent = c->parent;
parent != NULL && !parent->grav.do_sub_drift;
......@@ -1610,10 +1611,10 @@ void cell_activate_drift_gpart(struct cell *c, struct scheduler *s) {
parent->grav.do_sub_drift = 1;
if (parent == c->grav.super) {
#ifdef SWIFT_DEBUG_CHECKS
if (parent->grav.drift_gpart == NULL)
error("Trying to activate un-existing parent->grav.drift_gpart");
if (parent->grav.drift == NULL)
error("Trying to activate un-existing parent->grav.drift");
#endif
scheduler_activate(s, parent->grav.drift_gpart);
scheduler_activate(s, parent->grav.drift);
break;
}
}
......@@ -1689,10 +1690,10 @@ void cell_activate_subcell_hydro_tasks(struct cell *ci, struct cell *cj,
const struct engine *e = s->space->e;
/* Store the current dx_max and h_max values. */
ci->hydro.dx_max_old = ci->hydro.dx_max;
ci->hydro.dx_max_part_old = ci->hydro.dx_max_part;
ci->hydro.h_max_old = ci->hydro.h_max;
if (cj != NULL) {
cj->hydro.dx_max_old = cj->hydro.dx_max;
cj->hydro.dx_max_part_old = cj->hydro.dx_max_part;
cj->hydro.h_max_old = cj->hydro.h_max;
}
......@@ -2062,7 +2063,7 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
if (cj == NULL) {
/* Do anything? */
if (ci->grav.gcount == 0 || !cell_is_active_gravity(ci, e)) return;
if (ci->grav.count == 0 || !cell_is_active_gravity(ci, e)) return;
/* Recurse? */
if (ci->split) {
......@@ -2090,7 +2091,7 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
/* Anything to do here? */
if (!cell_is_active_gravity(ci, e) && !cell_is_active_gravity(cj, e))
return;
if (ci->grav.gcount == 0 || cj->grav.gcount == 0) return;
if (ci->grav.count == 0 || cj->grav.count == 0) return;
/* Atomically drift the multipole in ci */
lock_lock(&ci->grav.mlock);
......@@ -2279,12 +2280,12 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
/* If the local cell is active, receive data from the foreign cell. */
if (cj_active) {
scheduler_activate(s, ci->hydro.recv_xv);
scheduler_activate(s, ci->mpi.hydro.recv_xv);
if (ci_active) {
scheduler_activate(s, ci->hydro.recv_rho);
scheduler_activate(s, ci->mpi.hydro.recv_rho);
#ifdef EXTRA_HYDRO_LOOP
scheduler_activate(s, ci->hydro.recv_gradient);
scheduler_activate(s, ci->mpi.hydro.recv_gradient);
#endif
}
}
......@@ -2295,7 +2296,7 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
/* Is the foreign cell active and will need stuff from us? */
if (ci_active) {
scheduler_activate_send(s, cj->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
particles will be drifted, only those that are needed. */
......@@ -2303,10 +2304,10 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
/* If the local cell is also active, more stuff will be needed. */
if (cj_active) {
scheduler_activate_send(s, cj->hydro.send_rho, ci_nodeID);
scheduler_activate_send(s, cj->mpi.hydro.send_rho, ci_nodeID);
#ifdef EXTRA_HYDRO_LOOP
scheduler_activate_send(s, cj->hydro.send_gradient, ci_nodeID);
scheduler_activate_send(s, cj->mpi.hydro.send_gradient, ci_nodeID);
#endif
}
}
......@@ -2318,12 +2319,12 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
/* If the local cell is active, receive data from the foreign cell. */
if (ci_active) {
scheduler_activate(s, cj->hydro.recv_xv);
scheduler_activate(s, cj->mpi.hydro.recv_xv);
if (cj_active) {
scheduler_activate(s, cj->hydro.recv_rho);
scheduler_activate(s, cj->mpi.hydro.recv_rho);
#ifdef EXTRA_HYDRO_LOOP
scheduler_activate(s, cj->hydro.recv_gradient);
scheduler_activate(s, cj->mpi.hydro.recv_gradient);
#endif
}
}
......@@ -2334,7 +2335,7 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
/* Is the foreign cell active and will need stuff from us? */
if (cj_active) {
scheduler_activate_send(s, ci->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
particles will be drifted, only those that are needed. */
......@@ -2343,10 +2344,10 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
/* If the local cell is also active, more stuff will be needed. */
if (ci_active) {
scheduler_activate_send(s, ci->hydro.send_rho, cj_nodeID);
scheduler_activate_send(s, ci->mpi.hydro.send_rho, cj_nodeID);
#ifdef EXTRA_HYDRO_LOOP
scheduler_activate_send(s, ci->hydro.send_gradient, cj_nodeID);
scheduler_activate_send(s, ci->mpi.hydro.send_gradient, cj_nodeID);
#endif
}
}
......@@ -2440,7 +2441,7 @@ int cell_unskip_gravity_tasks(struct cell *c, struct scheduler *s) {
if (ci_nodeID != nodeID) {
/* If the local cell is active, receive data from the foreign cell. */
if (cj_active) scheduler_activate(s, ci->grav.recv);
if (cj_active) scheduler_activate(s, ci->mpi.grav.recv);
/* If the foreign cell is active, we want its ti_end values. */
if (ci_active) scheduler_activate(s, ci->mpi.recv_ti);
......@@ -2448,7 +2449,7 @@ int cell_unskip_gravity_tasks(struct cell *c, struct scheduler *s) {
/* Is the foreign cell active and will need stuff from us? */