Commit af3f90f0 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Post-merge fixes

parent af5593cd
...@@ -721,11 +721,11 @@ int cell_are_neighbours(const struct cell *restrict ci, ...@@ -721,11 +721,11 @@ int cell_are_neighbours(const struct cell *restrict ci,
const struct cell *restrict cj) { const struct cell *restrict cj) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (ci->h[0] != cj->h[0]) error("Cells of different size !"); if (ci->width[0] != cj->width[0]) error("Cells of different size !");
#endif #endif
/* Maximum allowed distance */ /* Maximum allowed distance */
const double min_dist = 1.2 * ci->h[0]; /* 1.2 accounts for rounding errors */ const double min_dist = 1.2 * ci->width[0]; /* 1.2 accounts for rounding errors */
/* (Manhattan) Distance between the cells */ /* (Manhattan) Distance between the cells */
for (int k = 0; k < 3; k++) { for (int k = 0; k < 3; k++) {
......
...@@ -2646,7 +2646,7 @@ void engine_step(struct engine *e) { ...@@ -2646,7 +2646,7 @@ void engine_step(struct engine *e) {
/* Check the gravity accelerations */ /* Check the gravity accelerations */
struct gpart *temp = malloc(s->nr_gparts * sizeof(struct gpart)); struct gpart *temp = malloc(s->nr_gparts * sizeof(struct gpart));
memcpy(temp, s->gparts, s->nr_gparts * sizeof(struct gpart)); memcpy(temp, s->gparts, s->nr_gparts * sizeof(struct gpart));
const double rlr = const_gravity_a_smooth * s->cells[0].h[0]; const double rlr = const_gravity_a_smooth * s->cells[0].width[0];
gravity_n2(temp, s->nr_gparts, e->physical_constants, rlr); gravity_n2(temp, s->nr_gparts, e->physical_constants, rlr);
file = fopen("grav_brute.dat", "w"); file = fopen("grav_brute.dat", "w");
for (size_t k = 0; k < s->nr_gparts; ++k) { for (size_t k = 0; k < s->nr_gparts; ++k) {
......
...@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm( ...@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm(
struct gpart *restrict gparts = ci->gparts; struct gpart *restrict gparts = ci->gparts;
const struct multipole multi = cj->multipole; const struct multipole multi = cj->multipole;
const int ti_current = e->ti_current; const int ti_current = e->ti_current;
const float rlr_inv = 1. / (const_gravity_a_smooth * ci->super->h[0]); const float rlr_inv = 1. / (const_gravity_a_smooth * ci->super->width[0]);
TIMER_TIC; TIMER_TIC;
...@@ -95,7 +95,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm( ...@@ -95,7 +95,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm(
if (gp->id_or_neg_offset == ICHECK) if (gp->id_or_neg_offset == ICHECK)
message("id=%lld loc=[ %f %f %f ] size= %f count= %d", message("id=%lld loc=[ %f %f %f ] size= %f count= %d",
gp->id_or_neg_offset, cj->loc[0], cj->loc[1], cj->loc[2], gp->id_or_neg_offset, cj->loc[0], cj->loc[1], cj->loc[2],
cj->h[0], cj->gcount); cj->width[0], cj->gcount);
} }
#endif #endif
...@@ -139,13 +139,13 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp( ...@@ -139,13 +139,13 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
struct gpart *restrict gparts_i = ci->gparts; struct gpart *restrict gparts_i = ci->gparts;
struct gpart *restrict gparts_j = cj->gparts; struct gpart *restrict gparts_j = cj->gparts;
const int ti_current = e->ti_current; const int ti_current = e->ti_current;
const float rlr_inv = 1. / (const_gravity_a_smooth * ci->super->h[0]); const float rlr_inv = 1. / (const_gravity_a_smooth * ci->super->width[0]);
TIMER_TIC; TIMER_TIC;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (ci->h[0] != cj->h[0]) // MATTHIEU sanity check if (ci->width[0] != cj->width[0]) // MATTHIEU sanity check
error("Non matching cell sizes !! h_i=%f h_j=%f", ci->h[0], cj->h[0]); error("Non matching cell sizes !! h_i=%f h_j=%f", ci->width[0], cj->width[0]);
#endif #endif
/* Anything to do here? */ /* Anything to do here? */
...@@ -160,7 +160,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp( ...@@ -160,7 +160,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
if (gp->id_or_neg_offset == ICHECK) if (gp->id_or_neg_offset == ICHECK)
message("id=%lld loc=[ %f %f %f ] size= %f count= %d", message("id=%lld loc=[ %f %f %f ] size= %f count= %d",
gp->id_or_neg_offset, cj->loc[0], cj->loc[1], cj->loc[2], gp->id_or_neg_offset, cj->loc[0], cj->loc[1], cj->loc[2],
cj->h[0], cj->gcount); cj->width[0], cj->gcount);
} }
for (int pid = 0; pid < gcount_j; pid++) { for (int pid = 0; pid < gcount_j; pid++) {
...@@ -171,7 +171,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp( ...@@ -171,7 +171,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
if (gp->id_or_neg_offset == ICHECK) if (gp->id_or_neg_offset == ICHECK)
message("id=%lld loc=[ %f %f %f ] size= %f count=%d", message("id=%lld loc=[ %f %f %f ] size= %f count=%d",
gp->id_or_neg_offset, ci->loc[0], ci->loc[1], ci->loc[2], gp->id_or_neg_offset, ci->loc[0], ci->loc[1], ci->loc[2],
ci->h[0], ci->gcount); ci->width[0], ci->gcount);
} }
#endif #endif
...@@ -233,7 +233,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp( ...@@ -233,7 +233,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
const int gcount = c->gcount; const int gcount = c->gcount;
struct gpart *restrict gparts = c->gparts; struct gpart *restrict gparts = c->gparts;
const int ti_current = e->ti_current; const int ti_current = e->ti_current;
const float rlr_inv = 1. / (const_gravity_a_smooth * c->super->h[0]); const float rlr_inv = 1. / (const_gravity_a_smooth * c->super->width[0]);
TIMER_TIC; TIMER_TIC;
...@@ -253,7 +253,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp( ...@@ -253,7 +253,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
if (gp->id_or_neg_offset == ICHECK) if (gp->id_or_neg_offset == ICHECK)
message("id=%lld loc=[ %f %f %f ] size= %f count= %d", message("id=%lld loc=[ %f %f %f ] size= %f count= %d",
gp->id_or_neg_offset, c->loc[0], c->loc[1], c->loc[2], c->h[0], gp->id_or_neg_offset, c->loc[0], c->loc[1], c->loc[2], c->width[0],
c->gcount); c->gcount);
} }
#endif #endif
...@@ -324,8 +324,8 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci, ...@@ -324,8 +324,8 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
if (gcount_i == 0 || gcount_j == 0) error("Empty cell !"); if (gcount_i == 0 || gcount_j == 0) error("Empty cell !");
/* Bad stuff will happen if cell sizes are different */ /* Bad stuff will happen if cell sizes are different */
if (ci->h[0] != cj->h[0]) if (ci->width[0] != cj->width[0])
error("Non matching cell sizes !! h_i=%f h_j=%f", ci->h[0], cj->h[0]); error("Non matching cell sizes !! h_i=%f h_j=%f", ci->width[0], cj->width[0]);
/* Sanity check */ /* Sanity check */
if (ci == cj) if (ci == cj)
...@@ -336,10 +336,10 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci, ...@@ -336,10 +336,10 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
/* Are the cells direct neighbours? */ /* Are the cells direct neighbours? */
if (!cell_are_neighbours(ci, cj)) if (!cell_are_neighbours(ci, cj))
error( error(
"Non-neighbouring cells ! ci->x=[%f %f %f] ci->h=%f cj->loc=[%f %f %f] " "Non-neighbouring cells ! ci->x=[%f %f %f] ci->width=%f cj->loc=[%f %f %f] "
"cj->h=%f", "cj->width=%f",
ci->loc[0], ci->loc[1], ci->loc[2], ci->h[0], cj->loc[0], cj->loc[1], ci->loc[0], ci->loc[1], ci->loc[2], ci->width[0], cj->loc[0], cj->loc[1],
cj->loc[2], cj->h[0]); cj->loc[2], cj->width[0]);
#endif #endif
...@@ -352,7 +352,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci, ...@@ -352,7 +352,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
if (gp->id_or_neg_offset == ICHECK) if (gp->id_or_neg_offset == ICHECK)
message("id=%lld loc=[ %f %f %f ] size= %f count= %d", message("id=%lld loc=[ %f %f %f ] size= %f count= %d",
gp->id_or_neg_offset, cj->loc[0], cj->loc[1], cj->loc[2], gp->id_or_neg_offset, cj->loc[0], cj->loc[1], cj->loc[2],
cj->h[0], cj->gcount); cj->width[0], cj->gcount);
} }
for (int pid = 0; pid < cj->gcount; pid++) { for (int pid = 0; pid < cj->gcount; pid++) {
...@@ -363,7 +363,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci, ...@@ -363,7 +363,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
if (gp->id_or_neg_offset == ICHECK) if (gp->id_or_neg_offset == ICHECK)
message("id=%lld loc=[ %f %f %f ] size= %f count= %d", message("id=%lld loc=[ %f %f %f ] size= %f count= %d",
gp->id_or_neg_offset, ci->loc[0], ci->loc[1], ci->loc[2], gp->id_or_neg_offset, ci->loc[0], ci->loc[1], ci->loc[2],
ci->h[0], ci->gcount); ci->width[0], ci->gcount);
} }
#endif #endif
...@@ -479,7 +479,7 @@ static void runner_do_grav_mm(struct runner *r, struct cell *ci, int timer) { ...@@ -479,7 +479,7 @@ static void runner_do_grav_mm(struct runner *r, struct cell *ci, int timer) {
if (gp->id_or_neg_offset == ICHECK) if (gp->id_or_neg_offset == ICHECK)
message("id=%lld loc=[ %f %f %f ] size= %f count= %d", message("id=%lld loc=[ %f %f %f ] size= %f count= %d",
gp->id_or_neg_offset, ci->loc[0], ci->loc[1], ci->loc[2], gp->id_or_neg_offset, ci->loc[0], ci->loc[1], ci->loc[2],
ci->h[0], ci->gcount); ci->width[0], ci->gcount);
} }
#endif #endif
...@@ -488,7 +488,7 @@ static void runner_do_grav_mm(struct runner *r, struct cell *ci, int timer) { ...@@ -488,7 +488,7 @@ static void runner_do_grav_mm(struct runner *r, struct cell *ci, int timer) {
struct cell *cells = e->s->cells; struct cell *cells = e->s->cells;
const int nr_cells = e->s->nr_cells; const int nr_cells = e->s->nr_cells;
const int ti_current = e->ti_current; const int ti_current = e->ti_current;
const double max_d = const_gravity_a_smooth * const_gravity_r_cut * ci->h[0]; const double max_d = const_gravity_a_smooth * const_gravity_r_cut * ci->width[0];
const double max_d2 = max_d * max_d; const double max_d2 = max_d * max_d;
const double pos_i[3] = {ci->loc[0], ci->loc[1], ci->loc[2]}; const double pos_i[3] = {ci->loc[0], ci->loc[1], ci->loc[2]};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment