diff --git a/src/debug.c b/src/debug.c index 067ca156e700883e56c57d50947de9f162dee86c..77d791a31787c7997a9a56e3204dac1160178976 100644 --- a/src/debug.c +++ b/src/debug.c @@ -224,11 +224,11 @@ int checkCellhdxmax(const struct cell *c, int *depth) { struct part *const p = &parts[k]; struct xpart *const xp = &xparts[k]; - if (p->x[0] < loc_min[0] || p->x[0] >= loc_max[0] || - p->x[1] < loc_min[1] || p->x[1] >= loc_max[1] || - p->x[2] < loc_min[2] || p->x[2] >= loc_max[2]) { + if (p->x[0] < loc_min[0] || p->x[0] >= loc_max[0] || p->x[1] < loc_min[1] || + p->x[1] >= loc_max[1] || p->x[2] < loc_min[2] || + p->x[2] >= loc_max[2]) { - error( + message( "Inconsistent part position p->x=[%e %e %e], c->loc=[%e %e %e] " "c->width=[%e %e %e]", p->x[0], p->x[1], p->x[2], c->loc[0], c->loc[1], c->loc[2], diff --git a/src/engine.c b/src/engine.c index ca4987a1e9cdcaeaa39c164ddc2c256780dfa2f2..cef4e3e6f3aa00c40ba92e3980b9fc472b6898bc 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4256,8 +4256,8 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs, if (prev_x[0] == s->parts[k].x[0] && prev_x[1] == s->parts[k].x[1] && prev_x[2] == s->parts[k].x[2]) { if (e->verbose) - message("Two particles occupy location: %f %f %f id=%lld id=%lld", prev_x[0], - prev_x[1], prev_x[2], *prev_id, s->parts[k].id); + message("Two particles occupy location: %f %f %f id=%lld id=%lld", + prev_x[0], prev_x[1], prev_x[2], *prev_id, s->parts[k].id); failed++; } prev_x = s->parts[k].x; diff --git a/src/periodic.h b/src/periodic.h index ba34534a4c342702bd0490fc263504c697224f00..7df36ac4c3927363305a7ef9fe3b369f58e7dd85 100644 --- a/src/periodic.h +++ b/src/periodic.h @@ -31,12 +31,12 @@ * Only wraps once. If x > 2b, the returned value will be larger than b. * Similarly for x < -b. */ -#define box_wrap(x, a, b) \ - ({ \ - const __typeof__(x) _x = (x); \ - const __typeof__(a) _a = (a); \ - const __typeof__(b) _b = (b); \ - _x < _a ? (_x + _b) : ((_x >= _b) ? (_x - _b) : _x);\ +#define box_wrap(x, a, b) \ + ({ \ + const __typeof__(x) _x = (x); \ + const __typeof__(a) _a = (a); \ + const __typeof__(b) _b = (b); \ + _x < _a ? (_x + _b) : ((_x >= _b) ? (_x - _b) : _x); \ }) /** diff --git a/src/runner.c b/src/runner.c index 7e91c642fb1b8c6f3c9a9d1188a718ad5ccb065c..592ccdb5b411dbfa0ea60dd3928a53a4a79c5cb5 100644 --- a/src/runner.c +++ b/src/runner.c @@ -775,7 +775,7 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { /* Self-interaction? */ if (l->t->type == task_type_self) runner_doself_subset_branch_density(r, finger, parts, pid, count); - + /* Otherwise, pair interaction? */ else if (l->t->type == task_type_pair) { diff --git a/src/runner_doiact.h b/src/runner_doiact.h index e4521b9dca9251da1a05b8c7b79aca45034cde76..dda34a6dc3eb7cb3ee77789cfb4a8cd51db37266 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -789,7 +789,7 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci, /** * @brief Determine which version of DOSELF_SUBSET needs to be called depending * on the optimisation level. - + * @param r The #runner. * @param ci The first #cell. * @param parts The #part to interact. @@ -801,9 +801,9 @@ void DOSELF_SUBSET_BRANCH(struct runner *r, struct cell *restrict ci, int count) { #if defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) - runner_doself_subset_density_vec(r, ci, parts, ind, count); + runner_doself_subset_density_vec(r, ci, parts, ind, count); #else - DOSELF_SUBSET(r, ci, parts, ind, count); + DOSELF_SUBSET(r, ci, parts, ind, count); #endif } diff --git a/src/scheduler.c b/src/scheduler.c index fb18ac5b064d8481dc166b17b9d526a5ffb998ec..860e28bf766a3350ef069a5623e85b8147949727 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1213,11 +1213,11 @@ void scheduler_reweight(struct scheduler *s, int verbose) { cost = 2.f * (wscale * t->ci->gcount) * t->cj->gcount; } else { if (t->ci->nodeID != nodeID || t->cj->nodeID != nodeID) - cost = - 3.f * (wscale * t->ci->count) * t->cj->count * sid_scale[t->flags]; + cost = 3.f * (wscale * t->ci->count) * t->cj->count * + sid_scale[t->flags]; else - cost = - 2.f * (wscale * t->ci->count) * t->cj->count * sid_scale[t->flags]; + cost = 2.f * (wscale * t->ci->count) * t->cj->count * + sid_scale[t->flags]; } break; @@ -1226,14 +1226,14 @@ void scheduler_reweight(struct scheduler *s, int verbose) { if (t->flags < 0) cost = 3.f * (wscale * t->ci->count) * t->cj->count; else - cost = - 3.f * (wscale * t->ci->count) * t->cj->count * sid_scale[t->flags]; + cost = 3.f * (wscale * t->ci->count) * t->cj->count * + sid_scale[t->flags]; } else { if (t->flags < 0) cost = 2.f * (wscale * t->ci->count) * t->cj->count; else - cost = - 2.f * (wscale * t->ci->count) * t->cj->count * sid_scale[t->flags]; + cost = 2.f * (wscale * t->ci->count) * t->cj->count * + sid_scale[t->flags]; } break; @@ -1274,16 +1274,16 @@ void scheduler_reweight(struct scheduler *s, int verbose) { cost = wscale * t->ci->count + wscale * t->ci->gcount; break; case task_type_send: - if(t->ci->count < 1e5) - cost = 10.f * (wscale * t->ci->count) * t->ci->count; - else - cost = 2e9; + if (t->ci->count < 1e5) + cost = 10.f * (wscale * t->ci->count) * t->ci->count; + else + cost = 2e9; break; case task_type_recv: - if(t->ci->count < 1e5) - cost = 5.f * (wscale * t->ci->count) * t->ci->count; - else - cost = 1e9; + if (t->ci->count < 1e5) + cost = 5.f * (wscale * t->ci->count) * t->ci->count; + else + cost = 1e9; break; default: cost = 0; diff --git a/src/space.c b/src/space.c index 8a07e2e32d604b5e7a7c209d0990cc813ab38d85..14da83648c6924f7d621788c79aa5afeabcaf5fa 100644 --- a/src/space.c +++ b/src/space.c @@ -1081,10 +1081,10 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts, ind[k] = index; #ifdef SWIFT_DEBUG_CHECKS - if(index < 0 || index > cdim[0] * cdim[1] * cdim[2]) - error("Invalid index=%d cdim=[%d %d %d] p->x=[%e %e %e]", index, - cdim[0], cdim[1], cdim[2], pos_x, pos_y, pos_z); - + if (index < 0 || index > cdim[0] * cdim[1] * cdim[2]) + error("Invalid index=%d cdim=[%d %d %d] p->x=[%e %e %e]", index, cdim[0], + cdim[1], cdim[2], pos_x, pos_y, pos_z); + if (pos_x >= dim_x || pos_y >= dim_y || pos_z >= dim_z || pos_x < 0. || pos_y < 0. || pos_z < 0.) error("Particle outside of simulation box. p->x=[%e %e %e]", pos_x, pos_y, @@ -1143,16 +1143,16 @@ void space_gparts_get_cell_index_mapper(void *map_data, int nr_gparts, ind[k] = index; #ifdef SWIFT_DEBUG_CHECKS - if(index < 0 || index > cdim[0] * cdim[1] * cdim[2]) - error("Invalid index=%d cdim=[%d %d %d] p->x=[%e %e %e]", index, - cdim[0], cdim[1], cdim[2], pos_x, pos_y, pos_z); - + if (index < 0 || index > cdim[0] * cdim[1] * cdim[2]) + error("Invalid index=%d cdim=[%d %d %d] p->x=[%e %e %e]", index, cdim[0], + cdim[1], cdim[2], pos_x, pos_y, pos_z); + if (pos_x >= dim_x || pos_y >= dim_y || pos_z >= dim_z || pos_x < 0. || pos_y < 0. || pos_z < 0.) error("Particle outside of simulation box. p->x=[%e %e %e]", pos_x, pos_y, pos_z); #endif - + /* Update the position */ gp->x[0] = pos_x; gp->x[1] = pos_y; @@ -1205,16 +1205,16 @@ void space_sparts_get_cell_index_mapper(void *map_data, int nr_sparts, ind[k] = index; #ifdef SWIFT_DEBUG_CHECKS - if(index < 0 || index > cdim[0] * cdim[1] * cdim[2]) - error("Invalid index=%d cdim=[%d %d %d] p->x=[%e %e %e]", index, - cdim[0], cdim[1], cdim[2], pos_x, pos_y, pos_z); - + if (index < 0 || index > cdim[0] * cdim[1] * cdim[2]) + error("Invalid index=%d cdim=[%d %d %d] p->x=[%e %e %e]", index, cdim[0], + cdim[1], cdim[2], pos_x, pos_y, pos_z); + if (pos_x >= dim_x || pos_y >= dim_y || pos_z >= dim_z || pos_x < 0. || pos_y < 0. || pos_z < 0.) error("Particle outside of simulation box. p->x=[%e %e %e]", pos_x, pos_y, pos_z); #endif - + /* Update the position */ sp->x[0] = pos_x; sp->x[1] = pos_y; @@ -2635,10 +2635,6 @@ void space_first_init_parts(struct space *s) { p[i].v[1] = p[i].v[2] = 0.f; #endif - double temp = p[i].v[0]; - p[i].v[0] = p[i].v[1]; - p[i].v[1] = temp; - hydro_first_init_part(&p[i], &xp[i]); #ifdef SWIFT_DEBUG_CHECKS