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

Update main code with modification in cell.h

parent c7ee1e42
......@@ -1084,19 +1084,22 @@ 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,
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
(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->count
(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->gcount
(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->gcount
(e.sched.tasks[l].cj != NULL)
? e.sched.tasks[l].cj->grav.gcount
: 0,
e.sched.tasks[l].flags, e.sched.tasks[l].sid);
}
......@@ -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);
}
/**
......
......@@ -197,12 +197,12 @@ __attribute__((always_inline)) INLINE void cache_read_particles(
swift_declare_aligned_ptr(float, vy, ci_cache->vy, SWIFT_CACHE_ALIGNMENT);
swift_declare_aligned_ptr(float, vz, ci_cache->vz, SWIFT_CACHE_ALIGNMENT);
const struct part *restrict parts = ci->parts;
const struct part *restrict parts = ci->hydro.parts;
const double loc[3] = {ci->loc[0], ci->loc[1], ci->loc[2]};
/* Shift the particles positions to a local frame so single precision can be
* used instead of double precision. */
for (int i = 0; i < ci->count; i++) {
for (int i = 0; i < ci->hydro.count; i++) {
x[i] = (float)(parts[i].x[0] - loc[0]);
y[i] = (float)(parts[i].x[1] - loc[1]);
z[i] = (float)(parts[i].x[2] - loc[2]);
......@@ -248,7 +248,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subset(
swift_declare_aligned_ptr(float, vy, ci_cache->vy, SWIFT_CACHE_ALIGNMENT);
swift_declare_aligned_ptr(float, vz, ci_cache->vz, SWIFT_CACHE_ALIGNMENT);
const struct part *restrict parts = ci->parts;
const struct part *restrict parts = ci->hydro.parts;
/* The cell is on the right so read the particles
* into the cache from the start of the cell. */
......@@ -258,7 +258,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subset(
const int pad = VEC_SIZE - rem;
/* Increase last_pi if there are particles in the cell left to read. */
if (*last_pi + pad < ci->count) *last_pi += pad;
if (*last_pi + pad < ci->hydro.count) *last_pi += pad;
}
/* Shift the particles positions to a local frame so single precision can be
......@@ -278,11 +278,11 @@ __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->dx_max_part;
const double max_dx = ci->hydro.dx_max;
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx),
-(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
const float h_padded = ci->parts[0].h;
const float h_padded = ci->hydro.parts[0].h;
for (int i = *last_pi; i < *last_pi + VEC_SIZE; i++) {
x[i] = pos_padded[0];
......@@ -299,7 +299,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subset(
/* The cell is on the left so read the particles
* into the cache from the end of the cell. */
else {
const int rem = (ci->count - *first_pi) % VEC_SIZE;
const int rem = (ci->hydro.count - *first_pi) % VEC_SIZE;
if (rem != 0) {
const int pad = VEC_SIZE - rem;
......@@ -307,7 +307,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subset(
if (*first_pi - pad >= 0) *first_pi -= pad;
}
const int ci_cache_count = ci->count - *first_pi;
const int ci_cache_count = ci->hydro.count - *first_pi;
/* Shift the particles positions to a local frame so single precision can be
* used instead of double precision. */
......@@ -326,14 +326,14 @@ __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->dx_max_part;
const double max_dx = ci->hydro.dx_max;
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx),
-(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
const float h_padded = ci->parts[0].h;
const float h_padded = ci->hydro.parts[0].h;
for (int i = ci->count - *first_pi; i < ci->count - *first_pi + VEC_SIZE;
i++) {
for (int i = ci->hydro.count - *first_pi;
i < ci->hydro.count - *first_pi + VEC_SIZE; i++) {
x[i] = pos_padded[0];
y[i] = pos_padded[1];
z[i] = pos_padded[2];
......@@ -382,12 +382,12 @@ __attribute__((always_inline)) INLINE void cache_read_force_particles(
swift_declare_aligned_ptr(float, soundspeed, ci_cache->soundspeed,
SWIFT_CACHE_ALIGNMENT);
const struct part *restrict parts = ci->parts;
const struct part *restrict parts = ci->hydro.parts;
const double loc[3] = {ci->loc[0], ci->loc[1], ci->loc[2]};
/* Shift the particles positions to a local frame so single precision can be
* used instead of double precision. */
for (int i = 0; i < ci->count; i++) {
for (int i = 0; i < ci->hydro.count; i++) {
x[i] = (float)(parts[i].x[0] - loc[0]);
y[i] = (float)(parts[i].x[1] - loc[1]);
z[i] = (float)(parts[i].x[2] - loc[2]);
......@@ -433,7 +433,7 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
* cache. */
/* Is the number of particles to read a multiple of the vector size? */
int rem = (ci->count - *first_pi) % VEC_SIZE;
int rem = (ci->hydro.count - *first_pi) % VEC_SIZE;
if (rem != 0) {
int pad = VEC_SIZE - rem;
......@@ -446,14 +446,14 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
int pad = VEC_SIZE - rem;
/* Increase last_pj if there are particles in the cell left to read. */
if (*last_pj + pad < cj->count) *last_pj += pad;
if (*last_pj + pad < cj->hydro.count) *last_pj += pad;
}
/* Get some local pointers */
const int first_pi_align = *first_pi;
const int last_pj_align = *last_pj;
const struct part *restrict parts_i = ci->parts;
const struct part *restrict parts_j = cj->parts;
const struct part *restrict parts_i = ci->hydro.parts;
const struct part *restrict parts_j = cj->hydro.parts;
/* Shift particles to the local frame and account for boundary conditions.*/
const double total_ci_shift[3] = {
......@@ -471,7 +471,7 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
swift_declare_aligned_ptr(float, vy, ci_cache->vy, SWIFT_CACHE_ALIGNMENT);
swift_declare_aligned_ptr(float, vz, ci_cache->vz, SWIFT_CACHE_ALIGNMENT);
int ci_cache_count = ci->count - first_pi_align;
int ci_cache_count = ci->hydro.count - first_pi_align;
/* Shift the particles positions to a local frame (ci frame) so single
* precision can be used instead of double precision. */
......@@ -491,11 +491,11 @@ __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->dx_max_part, cj->dx_max_part);
2. * ci->width[0] + 2. * max(ci->hydro.dx_max, cj->hydro.dx_max);
const float shift_threshold_y =
2. * ci->width[1] + 2. * max(ci->dx_max_part, cj->dx_max_part);
2. * ci->width[1] + 2. * max(ci->hydro.dx_max, cj->hydro.dx_max);
const float shift_threshold_z =
2. * ci->width[2] + 2. * max(ci->dx_max_part, cj->dx_max_part);
2. * ci->width[2] + 2. * max(ci->hydro.dx_max, cj->hydro.dx_max);
/* Make sure that particle positions have been shifted correctly. */
for (int i = 0; i < ci_cache_count; i++) {
......@@ -529,14 +529,14 @@ __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->dx_max_part, cj->dx_max_part);
const double max_dx = max(ci->hydro.dx_max, cj->hydro.dx_max);
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx),
-(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
const float h_padded = ci->parts[0].h;
const float h_padded = ci->hydro.parts[0].h;
for (int i = ci->count - first_pi_align;
i < ci->count - first_pi_align + VEC_SIZE; i++) {
for (int i = ci->hydro.count - first_pi_align;
i < ci->hydro.count - first_pi_align + VEC_SIZE; i++) {
x[i] = pos_padded[0];
y[i] = pos_padded[1];
z[i] = pos_padded[2];
......@@ -609,7 +609,7 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
const float pos_padded_j[3] = {-(2. * cj->width[0] + max_dx),
-(2. * cj->width[1] + max_dx),
-(2. * cj->width[2] + max_dx)};
const float h_padded_j = cj->parts[0].h;
const float h_padded_j = cj->hydro.parts[0].h;
for (int i = last_pj_align + 1; i < last_pj_align + 1 + VEC_SIZE; i++) {
xj[i] = pos_padded_j[0];
......@@ -650,7 +650,7 @@ cache_read_two_partial_cells_sorted_force(
* cache. */
/* Is the number of particles to read a multiple of the vector size? */
int rem = (ci->count - *first_pi) % VEC_SIZE;
int rem = (ci->hydro.count - *first_pi) % VEC_SIZE;
if (rem != 0) {
int pad = VEC_SIZE - rem;
......@@ -663,14 +663,14 @@ cache_read_two_partial_cells_sorted_force(
int pad = VEC_SIZE - rem;
/* Increase last_pj if there are particles in the cell left to read. */
if (*last_pj + pad < cj->count) *last_pj += pad;
if (*last_pj + pad < cj->hydro.count) *last_pj += pad;
}
/* Get some local pointers */
const int first_pi_align = *first_pi;
const int last_pj_align = *last_pj;
const struct part *restrict parts_i = ci->parts;
const struct part *restrict parts_j = cj->parts;
const struct part *restrict parts_i = ci->hydro.parts;
const struct part *restrict parts_j = cj->hydro.parts;
/* Shift particles to the local frame and account for boundary conditions.*/
const double total_ci_shift[3] = {
......@@ -697,7 +697,7 @@ cache_read_two_partial_cells_sorted_force(
swift_declare_aligned_ptr(float, soundspeed, ci_cache->soundspeed,
SWIFT_CACHE_ALIGNMENT);
int ci_cache_count = ci->count - first_pi_align;
int ci_cache_count = ci->hydro.count - first_pi_align;
/* Shift the particles positions to a local frame (ci frame) so single
* precision can be used instead of double precision. */
for (int i = 0; i < ci_cache_count; i++) {
......@@ -723,14 +723,14 @@ 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->dx_max_part, cj->dx_max_part);
const double max_dx = max(ci->hydro.dx_max, cj->hydro.dx_max);
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx),
-(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
const float h_padded = ci->parts[0].h;
const float h_padded = ci->hydro.parts[0].h;
for (int i = ci->count - first_pi_align;
i < ci->count - first_pi_align + VEC_SIZE; i++) {
for (int i = ci->hydro.count - first_pi_align;
i < ci->hydro.count - first_pi_align + VEC_SIZE; i++) {
x[i] = pos_padded[0];
y[i] = pos_padded[1];
z[i] = pos_padded[2];
......@@ -791,7 +791,7 @@ cache_read_two_partial_cells_sorted_force(
const float pos_padded_j[3] = {-(2. * cj->width[0] + max_dx),
-(2. * cj->width[1] + max_dx),
-(2. * cj->width[2] + max_dx)};
const float h_padded_j = cj->parts[0].h;
const float h_padded_j = cj->hydro.parts[0].h;
for (int i = last_pj_align + 1; i < last_pj_align + 1 + VEC_SIZE; i++) {
xj[i] = pos_padded_j[0];
......
This diff is collapsed.
......@@ -100,7 +100,6 @@ struct pcell {
} hydro;
/*! Gravity variables */
struct {
......@@ -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. */
......@@ -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