Commit 0473da3a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Applied code formatting tool.

parent 48df22d5
......@@ -2025,8 +2025,10 @@ void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) {
parent->stars.do_sub_sort = 1;
if (parent == c->hydro.super) {
#ifdef SWIFT_DEBUG_CHECKS
if ((parent->nodeID == engine_rank && parent->stars.sorts_local == NULL) ||
(parent->nodeID != engine_rank && parent->stars.sorts_foreign == NULL))
if ((parent->nodeID == engine_rank &&
parent->stars.sorts_local == NULL) ||
(parent->nodeID != engine_rank &&
parent->stars.sorts_foreign == NULL))
error("Trying to activate un-existing parents->stars.sorts");
#endif
if (parent->nodeID == engine_rank) {
......@@ -3354,8 +3356,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) {
const int ci_nodeID = ci->nodeID;
const int cj_nodeID = (cj != NULL) ? cj->nodeID : -1;
if (t->type == task_type_self &&
ci_active && ci->nodeID == nodeID) {
if (t->type == task_type_self && ci_active && ci->nodeID == nodeID) {
cell_activate_drift_part(ci, s);
cell_activate_drift_spart(ci, s);
......@@ -3479,7 +3480,6 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) {
particles will be drifted, only those that are needed. */
cell_activate_drift_part(ci, s);
}
}
#endif
}
......
......@@ -868,16 +868,18 @@ cell_can_recurse_in_self_hydro_task(const struct cell *c) {
* @param cj The #cell with hydro parts.
*/
__attribute__((always_inline)) INLINE static int
cell_can_recurse_in_pair_stars_task(const struct cell *ci, const struct cell *cj) {
cell_can_recurse_in_pair_stars_task(const struct cell *ci,
const struct cell *cj) {
/* Is the cell split ? */
/* 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 ci->split && cj->split && ((kernel_gamma * ci->stars.h_max_old +
ci->stars.dx_max_part_old) < 0.5f * ci->dmin) &&
((kernel_gamma * cj->hydro.h_max_old +
cj->hydro.dx_max_part_old) < 0.5f * cj->dmin);
return ci->split && cj->split &&
((kernel_gamma * ci->stars.h_max_old + ci->stars.dx_max_part_old) <
0.5f * ci->dmin) &&
((kernel_gamma * cj->hydro.h_max_old + cj->hydro.dx_max_part_old) <
0.5f * cj->dmin);
}
/**
......
......@@ -2684,7 +2684,8 @@ void engine_skip_force_and_kick(struct engine *e) {
t->type == task_type_grav_long_range || t->type == task_type_grav_mm ||
t->type == task_type_grav_down || t->type == task_type_cooling ||
t->type == task_type_star_formation ||
t->type == task_type_extra_ghost || t->subtype == task_subtype_gradient ||
t->type == task_type_extra_ghost ||
t->subtype == task_subtype_gradient ||
t->subtype == task_subtype_stars_feedback)
t->skip = 1;
}
......
......@@ -496,18 +496,15 @@ void engine_addtasks_recv_stars(struct engine *e, struct cell *c,
}
struct task *recv_rho = NULL;
if (c->mpi.hydro.recv_rho != NULL)
recv_rho = c->mpi.hydro.recv_rho;
if (c->mpi.hydro.recv_rho != NULL) recv_rho = c->mpi.hydro.recv_rho;
for (struct link *l = c->stars.feedback; l != NULL; l = l->next) {
scheduler_addunlock(s, t_feed, l->t);
/* Need gas density before feedback */
if (recv_rho != NULL)
scheduler_addunlock(s, c->mpi.hydro.recv_rho, l->t);
if (recv_rho != NULL) scheduler_addunlock(s, c->mpi.hydro.recv_rho, l->t);
}
/* Recurse? */
if (c->split)
for (int k = 0; k < 8; k++)
......@@ -2069,7 +2066,8 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements,
}
if (t->ci->hydro.super != t->cj->hydro.super) {
if (t->cj->nodeID != engine_rank) {
scheduler_addunlock(sched, t->cj->hydro.super->stars.sorts_foreign, t2);
scheduler_addunlock(sched, t->cj->hydro.super->stars.sorts_foreign,
t2);
}
}
......@@ -2159,7 +2157,8 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements,
}
if (t->ci->hydro.super != t->cj->hydro.super) {
if (t->ci->nodeID != engine_rank) {
scheduler_addunlock(sched, t->ci->hydro.super->stars.sorts_foreign, t2);
scheduler_addunlock(sched, t->ci->hydro.super->stars.sorts_foreign,
t2);
}
}
......@@ -2248,8 +2247,7 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements,
struct cell *cj = &cells[cjd];
/* Is that neighbour local and does it have particles ? */
if (cid >= cjd ||
(cj->stars.count == 0 && cj->hydro.count == 0) ||
if (cid >= cjd || (cj->stars.count == 0 && cj->hydro.count == 0) ||
(ci->nodeID != nodeID && cj->nodeID != nodeID))
continue;
......
......@@ -120,7 +120,6 @@ void engine_activate_stars_mpi(struct engine *e, struct scheduler *s,
sent, i.e. drift the cell specified in the send task (l->t)
itself. */
cell_activate_drift_part(l->t->ci, s);
}
}
}
......
......@@ -965,11 +965,10 @@ void runner_do_stars_sort(struct runner *r, struct cell *c, int flags,
for (int k = 0; k < 8; k++) {
if (c->progeny[k] != NULL && c->progeny[k]->stars.count > 0) {
/* Only propagate cleanup if the progeny is stale. */
const int cleanup_prog = cleanup &&
(c->progeny[k]->stars.dx_max_sort_old >
const int cleanup_prog =
cleanup && (c->progeny[k]->stars.dx_max_sort_old >
space_maxreldx * c->progeny[k]->dmin);
runner_do_stars_sort(r, c->progeny[k], flags,
cleanup_prog, 0);
runner_do_stars_sort(r, c->progeny[k], flags, cleanup_prog, 0);
dx_max_sort = max(dx_max_sort, c->progeny[k]->stars.dx_max_sort);
dx_max_sort_old =
max(dx_max_sort_old, c->progeny[k]->stars.dx_max_sort_old);
......@@ -3122,7 +3121,8 @@ void *runner_main(void *data) {
case task_type_stars_sort_local:
case task_type_stars_sort_foreign:
/* Cleanup only if any of the indices went stale. */
runner_do_stars_sort(r, ci, t->flags,
runner_do_stars_sort(
r, ci, t->flags,
ci->stars.dx_max_sort_old > space_maxreldx * ci->dmin, 1);
/* Reset the sort flags as our work here is done. */
t->flags = 0;
......
......@@ -1091,8 +1091,10 @@ static void scheduler_splittask_stars(struct task *t, struct scheduler *s) {
if (ci->progeny[j] != NULL)
for (int k = j + 1; k < 8; k++)
if (ci->progeny[k] != NULL &&
((ci->progeny[k]->stars.count != 0 && ci->progeny[j]->hydro.count != 0) ||
(ci->progeny[j]->stars.count != 0 && ci->progeny[k]->hydro.count != 0)))
((ci->progeny[k]->stars.count != 0 &&
ci->progeny[j]->hydro.count != 0) ||
(ci->progeny[j]->stars.count != 0 &&
ci->progeny[k]->hydro.count != 0)))
scheduler_splittask_stars(
scheduler_addtask(s, task_type_pair, t->subtype,
sub_sid_flag[j][k], 0, ci->progeny[j],
......
......@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static void stars_init_spart(
* @param dt_drift The drift time-step for positions.
*/
__attribute__((always_inline)) INLINE static void stars_predict_extra(
struct spart *restrict sp, float dt_drift) {
struct spart* restrict sp, float dt_drift) {
const float h_inv = 1.f / sp->h;
......@@ -82,7 +82,6 @@ __attribute__((always_inline)) INLINE static void stars_predict_extra(
sp->h *= approx_expf(w1); /* 4th order expansion of exp(w) */
else
sp->h *= expf(w1);
}
/**
......
......@@ -72,8 +72,7 @@ runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj,
float wi_dr = hid_inv * wi_dx;
/* Compute dv dot r */
float dvdr = (si->v[0] - pj->v[0]) * dx[0] +
(si->v[1] - pj->v[1]) * dx[1] +
float dvdr = (si->v[0] - pj->v[0]) * dx[0] + (si->v[1] - pj->v[1]) * dx[1] +
(si->v[2] - pj->v[2]) * dx[2];
/* Get the time derivative for h. */
......
......@@ -305,8 +305,7 @@ float task_overlap(const struct task *restrict ta,
if (tb->ci != NULL) size_union += tb->ci->stars.count;
if (tb->cj != NULL) size_union += tb->cj->stars.count;
if (size_union == 0)
return 0.f;
if (size_union == 0) return 0.f;
/* Compute the intersection of the cell data. */
const size_t size_intersect = task_cell_overlap_spart(ta->ci, tb->ci) +
......
......@@ -202,9 +202,9 @@ __attribute__((always_inline)) INLINE static integertime_t get_spart_timestep(
sp->gpart, a_hydro, e->gravity_properties, e->cosmology);
/* Limit change in smoothing length */
const float dt_h_change =
(sp->feedback.h_dt != 0.0f)
? fabsf(e->stars_properties->log_max_h_change * sp->h / sp->feedback.h_dt)
const float dt_h_change = (sp->feedback.h_dt != 0.0f)
? fabsf(e->stars_properties->log_max_h_change *
sp->h / sp->feedback.h_dt)
: FLT_MAX;
/* Take the minimum of all */
......
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