Commit 9470da94 authored by Loic Hausammann's avatar Loic Hausammann

Update main code with modification in cell.h

parent c7ee1e42
......@@ -1084,21 +1084,24 @@ int main(int argc, char *argv[]) {
int count = 0;
for (int l = 0; l < e.sched.nr_tasks; l++) {
if (!e.sched.tasks[l].implicit && e.sched.tasks[l].toc != 0) {
fprintf(
file_thread,
" %03i %i %i %i %i %lli %lli %i %i %i %i %lli %i\n", myrank,
e.sched.tasks[l].rid, e.sched.tasks[l].type,
e.sched.tasks[l].subtype, (e.sched.tasks[l].cj == NULL),
e.sched.tasks[l].tic, e.sched.tasks[l].toc,
(e.sched.tasks[l].ci != NULL) ? e.sched.tasks[l].ci->count
: 0,
(e.sched.tasks[l].cj != NULL) ? e.sched.tasks[l].cj->count
: 0,
(e.sched.tasks[l].ci != NULL) ? e.sched.tasks[l].ci->gcount
: 0,
(e.sched.tasks[l].cj != NULL) ? e.sched.tasks[l].cj->gcount
: 0,
e.sched.tasks[l].flags, e.sched.tasks[l].sid);
fprintf(file_thread,
" %03i %i %i %i %i %lli %lli %i %i %i %i %lli %i\n",
myrank, e.sched.tasks[l].rid, e.sched.tasks[l].type,
e.sched.tasks[l].subtype, (e.sched.tasks[l].cj == NULL),
e.sched.tasks[l].tic, e.sched.tasks[l].toc,
(e.sched.tasks[l].ci != NULL)
? e.sched.tasks[l].ci->hydro.count
: 0,
(e.sched.tasks[l].cj != NULL)
? e.sched.tasks[l].cj->hydro.count
: 0,
(e.sched.tasks[l].ci != NULL)
? e.sched.tasks[l].ci->grav.gcount
: 0,
(e.sched.tasks[l].cj != NULL)
? e.sched.tasks[l].cj->grav.gcount
: 0,
e.sched.tasks[l].flags, e.sched.tasks[l].sid);
}
fflush(stdout);
count++;
......@@ -1126,10 +1129,14 @@ int main(int argc, char *argv[]) {
e.sched.tasks[l].rid, e.sched.tasks[l].type,
e.sched.tasks[l].subtype, (e.sched.tasks[l].cj == NULL),
e.sched.tasks[l].tic, e.sched.tasks[l].toc,
(e.sched.tasks[l].ci == NULL) ? 0 : e.sched.tasks[l].ci->count,
(e.sched.tasks[l].cj == NULL) ? 0 : e.sched.tasks[l].cj->count,
(e.sched.tasks[l].ci == NULL) ? 0 : e.sched.tasks[l].ci->gcount,
(e.sched.tasks[l].cj == NULL) ? 0 : e.sched.tasks[l].cj->gcount,
(e.sched.tasks[l].ci == NULL) ? 0
: e.sched.tasks[l].ci->hydro.count,
(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].cj == NULL) ? 0
: e.sched.tasks[l].cj->grav.gcount,
e.sched.tasks[l].sid);
}
}
......
......@@ -39,15 +39,15 @@ __attribute__((always_inline)) INLINE static int cell_are_part_drifted(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->ti_old_part > e->ti_current)
if (c->hydro.ti_old > 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, a=%e)",
c->ti_old_part, c->ti_old_part * e->time_base, e->ti_current,
c->hydro.ti_old, c->hydro.ti_old * e->time_base, e->ti_current,
e->ti_current * e->time_base, e->cosmology->a);
#endif
return (c->ti_old_part == e->ti_current);
return (c->hydro.ti_old == e->ti_current);
}
/**
......@@ -62,15 +62,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->ti_old_gpart > e->ti_current)
if (c->grav.ti_old_gpart > 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->ti_old_gpart, c->ti_old_gpart * e->time_base, e->ti_current,
e->ti_current * e->time_base);
c->grav.ti_old_gpart, c->grav.ti_old_gpart * e->time_base,
e->ti_current, e->ti_current * e->time_base);
#endif
return (c->ti_old_gpart == e->ti_current);
return (c->grav.ti_old_gpart == e->ti_current);
}
/* Are cells / particles active for regular tasks ? */
......@@ -86,15 +86,15 @@ __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_hydro_end_min < e->ti_current)
if (c->hydro.ti_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, a=%e)",
c->ti_hydro_end_min, c->ti_hydro_end_min * e->time_base, e->ti_current,
c->hydro.ti_end_min, c->hydro.ti_end_min * e->time_base, e->ti_current,
e->ti_current * e->time_base, e->cosmology->a);
#endif
return (c->ti_hydro_end_min == e->ti_current);
return (c->hydro.ti_end_min == e->ti_current);
}
/**
......@@ -108,14 +108,14 @@ __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_hydro_end_max < e->ti_current)
if (c->hydro.ti_end_max < e->ti_current)
error(
"cell in an impossible time-zone! c->ti_end_max=%lld "
"e->ti_current=%lld",
c->ti_hydro_end_max, e->ti_current);
c->hydro.ti_end_max, e->ti_current);
#endif
return (c->ti_hydro_end_max == e->ti_current);
return (c->hydro.ti_end_max == e->ti_current);
}
/**
......@@ -129,15 +129,15 @@ __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)
if (c->grav.ti_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, a=%e)",
c->ti_gravity_end_min, c->ti_gravity_end_min * e->time_base,
e->ti_current, e->ti_current * e->time_base, e->cosmology->a);
c->grav.ti_end_min, c->grav.ti_end_min * e->time_base, e->ti_current,
e->ti_current * e->time_base, e->cosmology->a);
#endif
return (c->ti_gravity_end_min == e->ti_current);
return (c->grav.ti_end_min == e->ti_current);
}
/**
......@@ -150,7 +150,7 @@ __attribute__((always_inline)) INLINE static int cell_is_active_gravity(
__attribute__((always_inline)) INLINE static int cell_is_active_gravity_mm(
const struct cell *c, const struct engine *e) {
return (c->ti_gravity_end_min == e->ti_current);
return (c->grav.ti_end_min == e->ti_current);
}
/**
......@@ -164,14 +164,14 @@ __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)
if (c->grav.ti_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);
c->grav.ti_end_max, e->ti_current);
#endif
return (c->ti_gravity_end_max == e->ti_current);
return (c->grav.ti_end_max == e->ti_current);
}
/**
......@@ -290,15 +290,15 @@ __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_hydro_beg_max > e->ti_current)
if (c->hydro.ti_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, a=%e)",
c->ti_hydro_beg_max, c->ti_hydro_beg_max * e->time_base, e->ti_current,
c->hydro.ti_beg_max, c->hydro.ti_beg_max * e->time_base, e->ti_current,
e->ti_current * e->time_base, e->cosmology->a);
#endif
return (c->ti_hydro_beg_max == e->ti_current);
return (c->hydro.ti_beg_max == e->ti_current);
}
/**
......@@ -312,15 +312,15 @@ __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)
if (c->grav.ti_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, a=%e)",
c->ti_gravity_beg_max, c->ti_gravity_beg_max * e->time_base,
e->ti_current, e->ti_current * e->time_base, e->cosmology->a);
c->grav.ti_beg_max, c->grav.ti_beg_max * e->time_base, e->ti_current,
e->ti_current * e->time_base, e->cosmology->a);
#endif
return (c->ti_gravity_beg_max == e->ti_current);
return (c->grav.ti_beg_max == e->ti_current);
}
/**
......
This diff is collapsed.
This diff is collapsed.
......@@ -97,16 +97,15 @@ struct pcell {
/*! Number of #part in this cell. */
int count;
} hydro;
/*! Gravity variables */
struct {
/*! This cell's gravity-related tensors */
struct multipole m_pole;
/*! Centre of mass. */
double CoM[3];
......@@ -139,7 +138,6 @@ struct pcell {
} grav;
/*! Relative indices of the cell's progeny. */
int progeny[8];
......@@ -172,7 +170,6 @@ struct pcell_step {
} hydro;
/*! Grav variables */
struct {
......@@ -182,7 +179,6 @@ struct pcell_step {
/*! Minimal integer end-of-timestep in this cell (gravity) */
integertime_t ti_end_max;
} grav;
};
/**
......@@ -225,8 +221,8 @@ struct cell {
/*! Pointer for the sorted indices. */
struct entry *sort[13];
/*! Super cell, i.e. the highest-level parent cell that has a hydro pair/self
* tasks */
/*! Super cell, i.e. the highest-level parent cell that has a hydro
* pair/self tasks */
struct cell *super;
/*! Last (integer) time the cell's part were drifted forward in time. */
......@@ -247,7 +243,8 @@ struct cell {
/*! Maximum end of (integer) time step in this cell for hydro tasks. */
integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for hydro tasks. */
/*! Maximum beginning of (integer) time step in this cell for hydro tasks.
*/
integertime_t ti_beg_max;
/*! Nr of #part in this cell. */
......@@ -255,7 +252,7 @@ struct cell {
/*! Spin lock for various uses (#part case). */
swift_lock_type lock;
/*! Number of #part updated in this cell. */
int updated;
......@@ -276,7 +273,7 @@ struct cell {
/*! Bit mask of sorts that need to be computed for this cell. */
unsigned int do_sort;
/*! Does this cell need to be drifted (hydro)? */
char do_drift;
......@@ -285,7 +282,7 @@ struct cell {
/*! Do any of this cell's sub-cells need to be sorted? */
char do_sub_sort;
/*! Bit-mask indicating the sorted directions */
unsigned int sorted;
......@@ -344,12 +341,12 @@ struct cell {
#endif
#ifdef SWIFT_DEBUG_CHECKS
/*! Last (integer) time the cell's sort arrays were updated. */
integertime_t ti_sort;
#endif
} hydro;
/*! Grav variables */
......@@ -367,20 +364,20 @@ struct cell {
/*! Minimum end of (integer) time step in this cell for gravity tasks. */
integertime_t ti_end_min;
/*! Maximum end of (integer) time step in this cell for gravity tasks. */
integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for gravity tasks.
*/
integertime_t ti_beg_max;
/*! Last (integer) time the cell's gpart were drifted forward in time. */
integertime_t ti_old_gpart;
/*! Last (integer) time the cell's multipole was drifted forward in time. */
integertime_t ti_old_multipole;
/*! Nr of #gpart in this cell. */
int gcount;
......@@ -428,7 +425,7 @@ struct cell {
/*! Task propagating the mesh forces to the particles */
struct task *mesh;
/*! Task propagating the multipole to the particles */
struct task *down;
......@@ -447,7 +444,6 @@ struct cell {
} grav;
/*! The first kick task */
struct task *kick1;
......@@ -625,8 +621,8 @@ cell_can_recurse_in_pair_hydro_task(const struct cell *c) {
/* If so, is the cut-off radius plus the max distance the parts have moved */
/* smaller than the sub-cell sizes ? */
/* Note: We use the _old values as these might have been updated by a drift */
return c->split &&
((kernel_gamma * c->hydro.h_max_old + c->hydro.dx_max_old) < 0.5f * c->dmin);
return c->split && ((kernel_gamma * c->hydro.h_max_old +
c->hydro.dx_max_old) < 0.5f * c->dmin);
}
/**
......@@ -682,7 +678,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_pair_hydro_task(
/* the sub-cell sizes ? */
/* Note that since tasks are create after a rebuild no need to take */
/* into account any part motion (i.e. dx_max == 0 here) */
return c->split && (space_stretch * kernel_gamma * c->hydro.h_max < 0.5f * c->dmin);
return c->split &&
(space_stretch * kernel_gamma * c->hydro.h_max < 0.5f * c->dmin);
}
/**
......@@ -699,7 +696,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_self_hydro_task(
/* the sub-cell sizes ? */
/* 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 */
return c->split && (space_stretch * kernel_gamma * c->hydro.h_max < 0.5f * c->dmin);
return c->split &&
(space_stretch * kernel_gamma * c->hydro.h_max < 0.5f * c->dmin);
}
/**
......@@ -767,8 +765,8 @@ __attribute__((always_inline)) INLINE static int cell_need_rebuild_for_pair(
/* Is the cut-off radius plus the max distance the parts in both cells have */
/* moved larger than the cell size ? */
/* Note ci->dmin == cj->dmin */
return (kernel_gamma * max(ci->hydro.h_max, cj->hydro.h_max) + ci->hydro.dx_max +
cj->hydro.dx_max >
return (kernel_gamma * max(ci->hydro.h_max, cj->hydro.h_max) +
ci->hydro.dx_max + cj->hydro.dx_max >
cj->dmin);
}
......@@ -784,7 +782,8 @@ __attribute__((always_inline)) INLINE static void cell_tag(struct cell *c) {
if (c->mpi.tag > 0) error("setting tag for already tagged cell");
#endif
if (c->mpi.tag < 0 && (c->mpi.tag = atomic_inc(&cell_next_tag)) > cell_max_tag)
if (c->mpi.tag < 0 &&
(c->mpi.tag = atomic_inc(&cell_next_tag)) > cell_max_tag)
error("Ran out of cell tags.");
#else
error("SWIFT was not compiled with MPI enabled.");
......
......@@ -172,8 +172,8 @@ int checkSpacehmax(struct space *s) {
float cell_h_max = 0.0f;
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells_top[k].nodeID == s->e->nodeID &&
s->cells_top[k].h_max > cell_h_max) {
cell_h_max = s->cells_top[k].h_max;
s->cells_top[k].hydro.h_max > cell_h_max) {
cell_h_max = s->cells_top[k].hydro.h_max;
}
}
......@@ -191,9 +191,9 @@ int checkSpacehmax(struct space *s) {
/* There is a problem. Hunt it down. */
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells_top[k].nodeID == s->e->nodeID) {
if (s->cells_top[k].h_max > part_h_max) {
message("cell %d is inconsistent (%f > %f)", k, s->cells_top[k].h_max,
part_h_max);
if (s->cells_top[k].hydro.h_max > part_h_max) {
message("cell %d is inconsistent (%f > %f)", k,
s->cells_top[k].hydro.h_max, part_h_max);
}
}
}
......@@ -229,9 +229,9 @@ int checkCellhdxmax(const struct cell *c, int *depth) {
const double loc_max[3] = {c->loc[0] + c->width[0], c->loc[1] + c->width[1],
c->loc[2] + c->width[2]};
const size_t nr_parts = c->count;
struct part *parts = c->parts;
struct xpart *xparts = c->xparts;
const size_t nr_parts = c->hydro.count;
struct part *parts = c->hydro.parts;
struct xpart *xparts = c->hydro.xparts;
for (size_t k = 0; k < nr_parts; k++) {
struct part *const p = &parts[k];
......@@ -268,14 +268,15 @@ int checkCellhdxmax(const struct cell *c, int *depth) {
}
/* Check. */
if (c->h_max != h_max) {
message("%d Inconsistent h_max: cell %f != parts %f", *depth, c->h_max,
h_max);
if (c->hydro.h_max != h_max) {
message("%d Inconsistent h_max: cell %f != parts %f", *depth,
c->hydro.h_max, h_max);
message("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]);
result = 0;
}
if (c->dx_max_part != dx_max) {
message("%d Inconsistent dx_max: %f != %f", *depth, c->dx_max_part, dx_max);
if (c->hydro.dx_max != dx_max) {
message("%d Inconsistent dx_max: %f != %f", *depth, c->hydro.dx_max,
dx_max);
message("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]);
result = 0;
}
......@@ -316,13 +317,13 @@ static void dumpCells_map(struct cell *c, void *data) {
#endif
/* Only cells with particles are dumped. */
if (c->count > 0 || c->gcount > 0 || c->scount > 0) {
if (c->hydro.count > 0 || c->grav.gcount > 0 || c->scount > 0) {
/* In MPI mode we may only output cells with foreign partners.
* These define the edges of the partitions. */
int ismpiactive = 0;
#if WITH_MPI
ismpiactive = (c->send_xv != NULL);
ismpiactive = (c->hydro.send_xv != NULL);
if (mpiactive)
mpiactive = ismpiactive;
else
......@@ -347,11 +348,11 @@ static void dumpCells_map(struct cell *c, void *data) {
/* If requested we work out how many particles are active in this cell. */
int pactcount = 0;
if (pactive) {
const struct part *parts = c->parts;
for (int k = 0; k < c->count; k++)
const struct part *parts = c->hydro.parts;
for (int k = 0; k < c->hydro.count; k++)
if (part_is_active(&parts[k], e)) pactcount++;
struct gpart *gparts = c->gparts;
for (int k = 0; k < c->gcount; k++)
struct gpart *gparts = c->grav.gparts;
for (int k = 0; k < c->grav.gcount; k++)
if (gpart_is_active(&gparts[k], e)) pactcount++;
struct spart *sparts = c->sparts;
for (int k = 0; k < c->scount; k++)
......@@ -362,9 +363,9 @@ static void dumpCells_map(struct cell *c, void *data) {
" %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6d %6d %6d %6d %6d %6d "
"%6.1f %20lld %6d %6d %6d %6d %6d %6d %6d\n",
c->loc[0], c->loc[1], c->loc[2], c->width[0], c->width[1],
c->width[2], e->step, c->count, c->gcount, c->scount, pactcount,
c->depth, ntasks, c->ti_hydro_end_min,
get_time_bin(c->ti_hydro_end_min), (c->super == c),
c->width[2], e->step, c->hydro.count, c->grav.gcount, c->scount,
pactcount, c->depth, ntasks, c->hydro.ti_end_min,
get_time_bin(c->hydro.ti_end_min), (c->super == c),
(c->parent == NULL), cell_is_active_hydro(c, e), c->nodeID,
c->nodeID == e->nodeID, ismpiactive);
}
......
This diff is collapsed.
......@@ -73,9 +73,9 @@ void map_cells_plot(struct cell *c, void *data) {
printf("%.16e %.16e %.16e\n\n\n", l[0] + h[0], l[1] + h[1], l[2]);
if (!c->split) {
for (int k = 0; k < c->count; k++)
printf("0 0 0 %.16e %.16e %.16e\n", c->parts[k].x[0], c->parts[k].x[1],
c->parts[k].x[2]);
for (int k = 0; k < c->hydro.count; k++)
printf("0 0 0 %.16e %.16e %.16e\n", c->hydro.parts[k].x[0],
c->hydro.parts[k].x[1], c->hydro.parts[k].x[2]);
printf("\n\n");
}
/* else
......@@ -102,11 +102,11 @@ void map_check(struct part *p, struct cell *c, void *data) {
void map_cellcheck(struct cell *c, void *data) {
int *count = (int *)data;
atomic_add(count, c->count);
atomic_add(count, c->hydro.count);
/* Loop over all parts and check if they are in the cell. */
for (int k = 0; k < c->count; k++) {
struct part *p = &c->parts[k];
for (int k = 0; k < c->hydro.count; k++) {
struct part *p = &c->hydro.parts[k];
if (p->x[0] < c->loc[0] || p->x[1] < c->loc[1] || p->x[2] < c->loc[2] ||
p->x[0] > c->loc[0] + c->width[0] ||
p->x[1] > c->loc[1] + c->width[1] ||
......@@ -122,8 +122,8 @@ void map_cellcheck(struct cell *c, void *data) {
}
/* Loop over all gparts and check if they are in the cell. */
for (int k = 0; k < c->gcount; k++) {
struct gpart *p = &c->gparts[k];
for (int k = 0; k < c->grav.gcount; k++) {
struct gpart *p = &c->grav.gparts[k];
if (p->x[0] < c->loc[0] || p->x[1] < c->loc[1] || p->x[2] < c->loc[2] ||
p->x[0] > c->loc[0] + c->width[0] ||
p->x[1] > c->loc[1] + c->width[1] ||
......
......@@ -185,8 +185,8 @@ INLINE static void gpart_to_mesh_CIC(const struct gpart* gp, double* rho, int N,
*/
void cell_gpart_to_mesh_CIC(const struct cell* c, double* rho, int N,
double fac, const double dim[3]) {
const int gcount = c->gcount;
const struct gpart* gparts = c->gparts;
const int gcount = c->grav.gcount;
const struct gpart* gparts = c->grav.gparts;
/* Assign all the gpart of that cell to the mesh */
for (int i = 0; i < gcount; ++i)
......
......@@ -1197,8 +1197,8 @@ static void repart_edge_metis(int vweights, int eweights, int timebins,
* we cut for that. Note that weight is added to the local and
* remote cells, as we want to keep both away from any cuts, this
* can overflow int, so take care. */
int dti = num_time_bins - get_time_bin(ci->ti_hydro_end_min);
int dtj = num_time_bins - get_time_bin(cj->ti_hydro_end_min);
int dti = num_time_bins - get_time_bin(ci->hydro.ti_end_min);
int dtj = num_time_bins - get_time_bin(cj->hydro.ti_end_min);
double dt = (double)(1 << dti) + (double)(1 << dtj);
weights_e[ik] += dt;
weights_e[jk] += dt;
......
......@@ -71,8 +71,8 @@ void proxy_tags_exchange(struct proxy *proxies, int num_proxies,
int offset_out[s->nr_cells];
for (int k = 0; k < s->nr_cells; k++) {
offset_out[k] = count_out;
if (s->cells_top[k].sendto) {
count_out += s->cells_top[k].pcell_size;
if (s->cells_top[k].mpi.sendto) {
count_out += s->cells_top[k].mpi.pcell_size;
}
}
......@@ -82,7 +82,7 @@ void proxy_tags_exchange(struct proxy *proxies, int num_proxies,
for (int k = 0; k < num_proxies; k++) {
for (int j = 0; j < proxies[k].nr_cells_in; j++) {
offset_in[proxies[k].cells_in[j] - s->cells_top] = count_in;
count_in += proxies[k].cells_in[j]->pcell_size;
count_in += proxies[k].cells_in[j]->mpi.pcell_size;
}
}
......@@ -97,7 +97,7 @@ void proxy_tags_exchange(struct proxy *proxies, int num_proxies,
/* Pack the local tags. */
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells_top[k].sendto) {
if (s->cells_top[k].mpi.sendto) {
cell_pack_tags(&s->cells_top[k], &tags_out[offset_out[k]]);
}
}
......@@ -129,8 +129,8 @@ void proxy_tags_exchange(struct proxy *proxies, int num_proxies,
const int cid = proxies[k].cells_in[j] - s->cells_top;
cids_in[recv_rid] = cid;
int err = MPI_Irecv(
&tags_in[offset_in[cid]], proxies[k].cells_in[j]->pcell_size, MPI_INT,
proxies[k].nodeID, cid, MPI_COMM_WORLD, &reqs_in[recv_rid]);
&tags_in[offset_in[cid]], proxies[k].cells_in[j]->mpi.pcell_size,
MPI_INT, proxies[k].nodeID, cid, MPI_COMM_WORLD, &reqs_in[recv_rid]);
if (err != MPI_SUCCESS) mpi_error(err, "Failed to irecv tags.");
recv_rid += 1;
}
......@@ -138,7 +138,7 @@ void proxy_tags_exchange(struct proxy *proxies, int num_proxies,
const int cid = proxies[k].cells_out[j] - s->cells_top;
cids_out[send_rid] = cid;
int err = MPI_Isend(
&tags_out[offset_out[cid]], proxies[k].cells_out[j]->pcell_size,
&tags_out[offset_out[cid]], proxies[k].cells_out[j]->mpi.pcell_size,
MPI_INT, proxies[k].nodeID, cid, MPI_COMM_WORLD, &reqs_out[send_rid]);
if (err != MPI_SUCCESS) mpi_error(err, "Failed to isend tags.");
send_rid += 1;
......@@ -193,7 +193,7 @@ void proxy_cells_exchange_first(struct proxy *p) {
/* Get the number of pcells we will need to send. */
p->size_pcells_out = 0;
for (int k = 0; k < p->nr_cells_out; k++)
p->size_pcells_out += p->cells_out[k]->pcell_size;
p->size_pcells_out += p->cells_out[k]->mpi.pcell_size;
/* Send the number of pcells. */
int err = MPI_Isend(&p->size_pcells_out, 1, MPI_INT, p->nodeID,
......@@ -209,9 +209,9 @@ void proxy_cells_exchange_first(struct proxy *p) {
sizeof(struct pcell) * p->size_pcells_out) != 0)
error("Failed to allocate pcell_out buffer.");
for (int ind = 0, k = 0; k < p->nr_cells_out; k++) {
memcpy(&p->pcells_out[ind], p->cells_out[k]->pcell,
sizeof(struct pcell) * p->cells_out[k]->pcell_size);
ind += p->cells_out[k]->pcell_size;
memcpy(&p->pcells_out[ind], p->cells_out[k]->mpi.pcell,
sizeof(struct pcell) * p->cells_out[k]->mpi.pcell_size);
ind += p->cells_out[k]->mpi.pcell_size;
}
/* Send the pcell buffer. */
......@@ -298,9 +298,9 @@ void proxy_cells_exchange(struct proxy *proxies, int num_proxies,
int offset[s->nr_cells];
for (int k = 0; k < s->nr_cells; k++) {
offset[k] = count_out;
if (s->cells_top[k].sendto)
if (s->cells_top[k].mpi.sendto)
count_out +=
(s->cells_top[k].pcell_size = cell_getsize(&s->cells_top[k]));
(s->cells_top[k].mpi.pcell_size = cell_getsize(&s->cells_top[k]));
}
if (s->e->verbose)
......@@ -317,9 +317,9 @@ void proxy_cells_exchange(struct proxy *proxies, int num_proxies,
/* Pack the cells. */
for (int k = 0; k < s->nr_cells; k++)
if (s->cells_top[k].sendto) {
if (s->cells_top[k].mpi.sendto) {
cell_pack(&s->cells_top[k], &pcells[offset[k]], with_gravity);
s->cells_top[k].pcell = &pcells[offset[k]];
s->cells_top[k].mpi.pcell = &pcells[offset[k]];
}
if (s->e->verbose)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -41,9 +41,9 @@ void runner_doself_stars_density(struct runner *r, struct cell *c, int timer) {
const float H = cosmo->H;
const int scount = c->scount;
const int count = c->count;
const int count = c->hydro.count;
struct spart *restrict sparts = c->sparts;
struct part *restrict parts = c->parts;
struct part *restrict parts = c->hydro.parts;
/* Loop over the sparts in ci. */
for (int sid = 0; sid < scount; sid++) {
......@@ -102,9 +102,9 @@ void runner_dosubpair_stars_density(struct runner *r, struct cell *restrict ci,
if (!cell_is_active_stars(ci, e) && !cell_is_active_stars(cj, e)) return;
const int scount_i = ci->scount;
const int count_j = cj->count;
const int count_j = cj->hydro.count;
struct spart *restrict sparts_i = ci->sparts;