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[]) { ...@@ -1084,21 +1084,24 @@ int main(int argc, char *argv[]) {
int count = 0; int count = 0;
for (int l = 0; l < e.sched.nr_tasks; l++) { for (int l = 0; l < e.sched.nr_tasks; l++) {
if (!e.sched.tasks[l].implicit && e.sched.tasks[l].toc != 0) { if (!e.sched.tasks[l].implicit && e.sched.tasks[l].toc != 0) {
fprintf( fprintf(file_thread,
file_thread, " %03i %i %i %i %i %lli %lli %i %i %i %i %lli %i\n",
" %03i %i %i %i %i %lli %lli %i %i %i %i %lli %i\n", myrank, myrank, e.sched.tasks[l].rid, e.sched.tasks[l].type,
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].subtype, (e.sched.tasks[l].cj == NULL), e.sched.tasks[l].tic, e.sched.tasks[l].toc,
e.sched.tasks[l].tic, e.sched.tasks[l].toc, (e.sched.tasks[l].ci != NULL)
(e.sched.tasks[l].ci != NULL) ? e.sched.tasks[l].ci->count ? e.sched.tasks[l].ci->hydro.count
: 0, : 0,
(e.sched.tasks[l].cj != NULL) ? e.sched.tasks[l].cj->count (e.sched.tasks[l].cj != NULL)
: 0, ? e.sched.tasks[l].cj->hydro.count
(e.sched.tasks[l].ci != NULL) ? e.sched.tasks[l].ci->gcount : 0,
: 0, (e.sched.tasks[l].ci != NULL)
(e.sched.tasks[l].cj != NULL) ? e.sched.tasks[l].cj->gcount ? e.sched.tasks[l].ci->grav.gcount
: 0, : 0,
e.sched.tasks[l].flags, e.sched.tasks[l].sid); (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); fflush(stdout);
count++; count++;
...@@ -1126,10 +1129,14 @@ int main(int argc, char *argv[]) { ...@@ -1126,10 +1129,14 @@ int main(int argc, char *argv[]) {
e.sched.tasks[l].rid, e.sched.tasks[l].type, 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].subtype, (e.sched.tasks[l].cj == NULL),
e.sched.tasks[l].tic, e.sched.tasks[l].toc, 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].ci == NULL) ? 0
(e.sched.tasks[l].cj == NULL) ? 0 : e.sched.tasks[l].cj->count, : e.sched.tasks[l].ci->hydro.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 == NULL) ? 0 : e.sched.tasks[l].cj->gcount, : 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); e.sched.tasks[l].sid);
} }
} }
......
...@@ -39,15 +39,15 @@ __attribute__((always_inline)) INLINE static int cell_are_part_drifted( ...@@ -39,15 +39,15 @@ __attribute__((always_inline)) INLINE static int cell_are_part_drifted(
const struct cell *c, const struct engine *e) { const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->ti_old_part > e->ti_current) if (c->hydro.ti_old > e->ti_current)
error( 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=%lld (t=%e) "
"and e->ti_current=%lld (t=%e, a=%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); e->ti_current * e->time_base, e->cosmology->a);
#endif #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( ...@@ -62,15 +62,15 @@ __attribute__((always_inline)) INLINE static int cell_are_gpart_drifted(
const struct cell *c, const struct engine *e) { const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->ti_old_gpart > e->ti_current) if (c->grav.ti_old_gpart > e->ti_current)
error( 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=%lld (t=%e) "
"and e->ti_current=%lld (t=%e)", "and e->ti_current=%lld (t=%e)",
c->ti_old_gpart, c->ti_old_gpart * e->time_base, e->ti_current, c->grav.ti_old_gpart, c->grav.ti_old_gpart * e->time_base,
e->ti_current * e->time_base); e->ti_current, e->ti_current * e->time_base);
#endif #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 ? */ /* Are cells / particles active for regular tasks ? */
...@@ -86,15 +86,15 @@ __attribute__((always_inline)) INLINE static int cell_is_active_hydro( ...@@ -86,15 +86,15 @@ __attribute__((always_inline)) INLINE static int cell_is_active_hydro(
const struct cell *c, const struct engine *e) { const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->ti_hydro_end_min < e->ti_current) if (c->hydro.ti_end_min < e->ti_current)
error( error(
"cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and " "cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and "
"e->ti_current=%lld (t=%e, a=%e)", "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); e->ti_current * e->time_base, e->cosmology->a);
#endif #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( ...@@ -108,14 +108,14 @@ __attribute__((always_inline)) INLINE static int cell_is_all_active_hydro(
const struct cell *c, const struct engine *e) { const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->ti_hydro_end_max < e->ti_current) if (c->hydro.ti_end_max < e->ti_current)
error( error(
"cell in an impossible time-zone! c->ti_end_max=%lld " "cell in an impossible time-zone! c->ti_end_max=%lld "
"e->ti_current=%lld", "e->ti_current=%lld",
c->ti_hydro_end_max, e->ti_current); c->hydro.ti_end_max, e->ti_current);
#endif #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( ...@@ -129,15 +129,15 @@ __attribute__((always_inline)) INLINE static int cell_is_active_gravity(
const struct cell *c, const struct engine *e) { const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->ti_gravity_end_min < e->ti_current) if (c->grav.ti_end_min < e->ti_current)
error( error(
"cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and " "cell in an impossible time-zone! c->ti_end_min=%lld (t=%e) and "
"e->ti_current=%lld (t=%e, a=%e)", "e->ti_current=%lld (t=%e, a=%e)",
c->ti_gravity_end_min, c->ti_gravity_end_min * e->time_base, c->grav.ti_end_min, c->grav.ti_end_min * e->time_base, e->ti_current,
e->ti_current, e->ti_current * e->time_base, e->cosmology->a); e->ti_current * e->time_base, e->cosmology->a);
#endif #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( ...@@ -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( __attribute__((always_inline)) INLINE static int cell_is_active_gravity_mm(
const struct cell *c, const struct engine *e) { 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( ...@@ -164,14 +164,14 @@ __attribute__((always_inline)) INLINE static int cell_is_all_active_gravity(
const struct cell *c, const struct engine *e) { const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->ti_gravity_end_max < e->ti_current) if (c->grav.ti_end_max < e->ti_current)
error( error(
"cell in an impossible time-zone! c->ti_end_max=%lld " "cell in an impossible time-zone! c->ti_end_max=%lld "
"e->ti_current=%lld", "e->ti_current=%lld",
c->ti_gravity_end_max, e->ti_current); c->grav.ti_end_max, e->ti_current);
#endif #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( ...@@ -290,15 +290,15 @@ __attribute__((always_inline)) INLINE static int cell_is_starting_hydro(
const struct cell *c, const struct engine *e) { const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->ti_hydro_beg_max > e->ti_current) if (c->hydro.ti_beg_max > e->ti_current)
error( error(
"cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and " "cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and "
"e->ti_current=%lld (t=%e, a=%e)", "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); e->ti_current * e->time_base, e->cosmology->a);
#endif #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( ...@@ -312,15 +312,15 @@ __attribute__((always_inline)) INLINE static int cell_is_starting_gravity(
const struct cell *c, const struct engine *e) { const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->ti_gravity_beg_max > e->ti_current) if (c->grav.ti_beg_max > e->ti_current)
error( error(
"cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and " "cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and "
"e->ti_current=%lld (t=%e, a=%e)", "e->ti_current=%lld (t=%e, a=%e)",
c->ti_gravity_beg_max, c->ti_gravity_beg_max * e->time_base, c->grav.ti_beg_max, c->grav.ti_beg_max * e->time_base, e->ti_current,
e->ti_current, e->ti_current * e->time_base, e->cosmology->a); e->ti_current * e->time_base, e->cosmology->a);
#endif #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 { ...@@ -97,16 +97,15 @@ struct pcell {
/*! Number of #part in this cell. */ /*! Number of #part in this cell. */
int count; int count;
} hydro; } hydro;
/*! Gravity variables */ /*! Gravity variables */
struct { struct {
/*! This cell's gravity-related tensors */ /*! This cell's gravity-related tensors */
struct multipole m_pole; struct multipole m_pole;
/*! Centre of mass. */ /*! Centre of mass. */
double CoM[3]; double CoM[3];
...@@ -139,7 +138,6 @@ struct pcell { ...@@ -139,7 +138,6 @@ struct pcell {
} grav; } grav;
/*! Relative indices of the cell's progeny. */ /*! Relative indices of the cell's progeny. */
int progeny[8]; int progeny[8];
...@@ -172,7 +170,6 @@ struct pcell_step { ...@@ -172,7 +170,6 @@ struct pcell_step {
} hydro; } hydro;
/*! Grav variables */ /*! Grav variables */
struct { struct {
...@@ -182,7 +179,6 @@ struct pcell_step { ...@@ -182,7 +179,6 @@ struct pcell_step {
/*! Minimal integer end-of-timestep in this cell (gravity) */ /*! Minimal integer end-of-timestep in this cell (gravity) */
integertime_t ti_end_max; integertime_t ti_end_max;
} grav; } grav;
}; };
/** /**
...@@ -225,8 +221,8 @@ struct cell { ...@@ -225,8 +221,8 @@ struct cell {
/*! Pointer for the sorted indices. */ /*! Pointer for the sorted indices. */
struct entry *sort[13]; struct entry *sort[13];
/*! Super cell, i.e. the highest-level parent cell that has a hydro pair/self /*! Super cell, i.e. the highest-level parent cell that has a hydro
* tasks */ * pair/self tasks */
struct cell *super; struct cell *super;
/*! Last (integer) time the cell's part were drifted forward in time. */ /*! Last (integer) time the cell's part were drifted forward in time. */
...@@ -247,7 +243,8 @@ struct cell { ...@@ -247,7 +243,8 @@ struct cell {
/*! Maximum end of (integer) time step in this cell for hydro tasks. */ /*! Maximum end of (integer) time step in this cell for hydro tasks. */
integertime_t ti_end_max; 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; integertime_t ti_beg_max;
/*! Nr of #part in this cell. */ /*! Nr of #part in this cell. */
...@@ -255,7 +252,7 @@ struct cell { ...@@ -255,7 +252,7 @@ struct cell {
/*! Spin lock for various uses (#part case). */ /*! Spin lock for various uses (#part case). */
swift_lock_type lock; swift_lock_type lock;
/*! Number of #part updated in this cell. */ /*! Number of #part updated in this cell. */
int updated; int updated;
...@@ -276,7 +273,7 @@ struct cell { ...@@ -276,7 +273,7 @@ struct cell {
/*! Bit mask of sorts that need to be computed for this cell. */ /*! Bit mask of sorts that need to be computed for this cell. */
unsigned int do_sort; unsigned int do_sort;
/*! Does this cell need to be drifted (hydro)? */ /*! Does this cell need to be drifted (hydro)? */
char do_drift; char do_drift;
...@@ -285,7 +282,7 @@ struct cell { ...@@ -285,7 +282,7 @@ struct cell {
/*! Do any of this cell's sub-cells need to be sorted? */ /*! Do any of this cell's sub-cells need to be sorted? */
char do_sub_sort; char do_sub_sort;
/*! Bit-mask indicating the sorted directions */ /*! Bit-mask indicating the sorted directions */
unsigned int sorted; unsigned int sorted;
...@@ -344,12 +341,12 @@ struct cell { ...@@ -344,12 +341,12 @@ struct cell {
#endif #endif
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/*! Last (integer) time the cell's sort arrays were updated. */ /*! Last (integer) time the cell's sort arrays were updated. */
integertime_t ti_sort; integertime_t ti_sort;
#endif #endif
} hydro; } hydro;
/*! Grav variables */ /*! Grav variables */
...@@ -367,20 +364,20 @@ struct cell { ...@@ -367,20 +364,20 @@ struct cell {
/*! Minimum end of (integer) time step in this cell for gravity tasks. */ /*! Minimum end of (integer) time step in this cell for gravity tasks. */
integertime_t ti_end_min; integertime_t ti_end_min;
/*! Maximum end of (integer) time step in this cell for gravity tasks. */ /*! Maximum end of (integer) time step in this cell for gravity tasks. */
integertime_t ti_end_max; integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for gravity tasks. /*! Maximum beginning of (integer) time step in this cell for gravity tasks.
*/ */
integertime_t ti_beg_max; integertime_t ti_beg_max;
/*! Last (integer) time the cell's gpart were drifted forward in time. */ /*! Last (integer) time the cell's gpart were drifted forward in time. */
integertime_t ti_old_gpart; integertime_t ti_old_gpart;
/*! Last (integer) time the cell's multipole was drifted forward in time. */ /*! Last (integer) time the cell's multipole was drifted forward in time. */
integertime_t ti_old_multipole; integertime_t ti_old_multipole;
/*! Nr of #gpart in this cell. */ /*! Nr of #gpart in this cell. */
int gcount; int gcount;
...@@ -428,7 +425,7 @@ struct cell { ...@@ -428,7 +425,7 @@ struct cell {
/*! Task propagating the mesh forces to the particles */ /*! Task propagating the mesh forces to the particles */
struct task *mesh; struct task *mesh;
/*! Task propagating the multipole to the particles */ /*! Task propagating the multipole to the particles */
struct task *down; struct task *down;
...@@ -447,7 +444,6 @@ struct cell { ...@@ -447,7 +444,6 @@ struct cell {
} grav; } grav;
/*! The first kick task */ /*! The first kick task */
struct task *kick1; struct task *kick1;
...@@ -625,8 +621,8 @@ cell_can_recurse_in_pair_hydro_task(const struct cell *c) { ...@@ -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 */ /* If so, is the cut-off radius plus the max distance the parts have moved */
/* smaller than the sub-cell sizes ? */ /* smaller than the sub-cell sizes ? */
/* Note: We use the _old values as these might have been updated by a drift */ /* Note: We use the _old values as these might have been updated by a drift */
return c->split && return c->split && ((kernel_gamma * c->hydro.h_max_old +
((kernel_gamma * c->hydro.h_max_old + c->hydro.dx_max_old) < 0.5f * c->dmin); 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( ...@@ -682,7 +678,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_pair_hydro_task(
/* the sub-cell sizes ? */ /* the sub-cell sizes ? */
/* Note that since tasks are create after a rebuild no need to take */ /* Note that since tasks are create after a rebuild no need to take */
/* into account any part motion (i.e. dx_max == 0 here) */ /* into account any part motion (i.e. dx_max == 0 here) */
return 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( ...@@ -699,7 +696,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_self_hydro_task(
/* the sub-cell sizes ? */ /* the sub-cell sizes ? */
/* Note: No need for more checks here as all the sub-pairs and sub-self */ /* Note: No need for more checks here as all the sub-pairs and sub-self */
/* tasks will be created. So no need to check for h_max */ /* tasks will be created. So no need to check for h_max */
return c->split && (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( ...@@ -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 */ /* Is the cut-off radius plus the max distance the parts in both cells have */
/* moved larger than the cell size ? */ /* moved larger than the cell size ? */
/* Note ci->dmin == cj->dmin */ /* Note ci->dmin == cj->dmin */
return (kernel_gamma * max(ci->hydro.h_max, cj->hydro.h_max) + ci->hydro.dx_max + return (kernel_gamma * max(ci->hydro.h_max, cj->hydro.h_max) +
cj->hydro.dx_max > ci->hydro.dx_max + cj->hydro.dx_max >
cj->dmin); cj->dmin);
} }
...@@ -784,7 +782,8 @@ __attribute__((always_inline)) INLINE static void cell_tag(struct cell *c) { ...@@ -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"); if (c->mpi.tag > 0) error("setting tag for already tagged cell");
#endif #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."); error("Ran out of cell tags.");
#else #else
error("SWIFT was not compiled with MPI enabled."); error("SWIFT was not compiled with MPI enabled.");
......
...@@ -172,8 +172,8 @@ int checkSpacehmax(struct space *s) { ...@@ -172,8 +172,8 @@ int checkSpacehmax(struct space *s) {
float cell_h_max = 0.0f; float cell_h_max = 0.0f;
for (int k = 0; k < s->nr_cells; k++) { for (int k = 0; k < s->nr_cells; k++) {
if (s->cells_top[k].nodeID == s->e->nodeID && if (s->cells_top[k].nodeID == s->e->nodeID &&
s->cells_top[k].h_max > cell_h_max) { s->cells_top[k].hydro.h_max > cell_h_max) {
cell_h_max = s->cells_top[k].h_max; cell_h_max = s->cells_top[k].hydro.h_max;
} }
} }
...@@ -191,9 +191,9 @@ int checkSpacehmax(struct space *s) { ...@@ -191,9 +191,9 @@ int checkSpacehmax(struct space *s) {
/* There is a problem. Hunt it down. */ /* There is a problem. Hunt it down. */
for (int k = 0; k < s->nr_cells; k++) { for (int k = 0; k < s->nr_cells; k++) {
if (s->cells_top[k].nodeID == s->e->nodeID) { if (s->cells_top[k].nodeID == s->e->nodeID) {
if (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].h_max, message("cell %d is inconsistent (%f > %f)", k,
part_h_max); s->cells_top[k].hydro.h_max, part_h_max);
} }
} }
} }
...@@ -229,9 +229,9 @@ int checkCellhdxmax(const struct cell *c, int *depth) { ...@@ -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], const double loc_max[3] = {c->loc[0] + c->width[0], c->loc[1] + c->width[1],
c->loc[2] + c->width[2]}; c->loc[2] + c->width[2]};
const size_t nr_parts = c->count; const size_t nr_parts = c->hydro.count;
struct part *parts = c->parts; struct part *parts = c->hydro.parts;
struct xpart *xparts = c->xparts; struct xpart *xparts = c->hydro.xparts;
for (size_t k = 0; k < nr_parts; k++) { for (size_t k = 0; k < nr_parts; k++) {
struct part *const p = &parts[k]; struct part *const p = &parts[k];
...@@ -268,14 +268,15 @@ int checkCellhdxmax(const struct cell *c, int *depth) { ...@@ -268,14 +268,15 @@ int checkCellhdxmax(const struct cell *c, int *depth) {
} }
/* Check. */ /* Check. */
if (c->h_max != h_max) { if (c->hydro.h_max != h_max) {
message("%d Inconsistent h_max: cell %f != parts %f", *depth, c->h_max, message("%d Inconsistent h_max: cell %f != parts %f", *depth,
h_max); c->hydro.h_max, h_max);
message("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]); message("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]);
result = 0; result = 0;
} }
if (c->dx_max_part != dx_max) { if (c->hydro.dx_max != dx_max) {
message("%d Inconsistent dx_max: %f != %f", *depth, c->dx_max_part, 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]); message("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]);
result = 0; result = 0;
} }
...@@ -316,13 +317,13 @@ static void dumpCells_map(struct cell *c, void *data) { ...@@ -316,13 +317,13 @@ static void dumpCells_map(struct cell *c, void *data) {
#endif #endif
/* Only cells with particles are dumped. */ /* 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. /* In MPI mode we may only output cells with foreign partners.
* These define the edges of the partitions. */ * These define the edges of the partitions. */
int ismpiactive = 0; int ismpiactive = 0;
#if WITH_MPI #if WITH_MPI
ismpiactive = (c->send_xv != NULL); ismpiactive = (c->hydro.send_xv != NULL);
if (mpiactive) if (mpiactive)
mpiactive = ismpiactive; mpiactive = ismpiactive;
else else
...@@ -347,11 +348,11 @@ static void dumpCells_map(struct cell *c, void *data) { ...@@ -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. */ /* If requested we work out how many particles are active in this cell. */
int pactcount = 0; int pactcount = 0;
if (pactive) { if (pactive) {
const struct part *parts = c->parts; const struct part *parts = c->hydro.parts;
for (int k = 0; k < c->count; k++) for (int k = 0; k < c->hydro.count; k++)
if (part_is_active(&parts[k], e)) pactcount++; if (part_is_active(&parts[k], e)) pactcount++;
struct gpart *gparts = c->gparts; struct gpart *gparts = c->grav.gparts;
for (int k = 0; k < c->gcount; k++) for (int k = 0; k < c->grav.gcount; k++)
if (gpart_is_active(&gparts[k], e)) pactcount++; if (gpart_is_active(&gparts[k], e)) pactcount++;
struct spart *sparts = c->sparts; struct spart *sparts = c->sparts;
for (int k = 0; k < c->scount; k++) for (int k = 0; k < c->scount; k++)
...@@ -362,9 +363,9 @@ static void dumpCells_map(struct cell *c, void *data) { ...@@ -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.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", "%6.1f %20lld %6d %6d %6d %6d %6d %6d %6d\n",
c->loc[0], c->loc[1], c->loc[2], c->width[0