From 23f1178d3c0039d337e45f359fd783e6cd814250 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Sat, 28 Jan 2017 12:02:13 +0000 Subject: [PATCH] Code formatting --- src/cooling/const_lambda/cooling.h | 2 +- src/hydro/Gadget2/hydro.h | 14 ++++++++------ tests/benchmarkInteractions.c | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h index fb51ea0af1..9fadd51e3c 100644 --- a/src/cooling/const_lambda/cooling.h +++ b/src/cooling/const_lambda/cooling.h @@ -91,7 +91,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( /* Integrate cooling equation to enforce energy floor */ /* Factor of 1.5 included since timestep could potentially double */ if (u_old + (hydro_du_dt + cooling_du_dt) * 1.5f * dt < u_floor) { - cooling_du_dt = -(u_old + 1.5f *dt * hydro_du_dt - u_floor) /(1.5f * dt); + cooling_du_dt = -(u_old + 1.5f * dt * hydro_du_dt - u_floor) / (1.5f * dt); } /* Update the internal energy time derivative */ diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h index 3c49f8a288..eaeecbffbc 100644 --- a/src/hydro/Gadget2/hydro.h +++ b/src/hydro/Gadget2/hydro.h @@ -334,6 +334,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( /* Predict the entropy */ p->entropy += p->entropy_dt * dt; + /* Re-compute the pressure */ const float pressure = gas_pressure_from_entropy(p->rho, p->entropy); @@ -376,12 +377,12 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra( struct part *restrict p, struct xpart *restrict xp, float dt) { /* Do not decrease the entropy by more than a factor of 2 */ - - if (p->entropy_dt < -0.5f * xp->entropy_full / dt){ - message("Warning! Limiting entropy_dt. Possible cooling error.\n entropy_full = %g \n entropy_dt * dt =%g \n", - xp->entropy_full,p->entropy_dt * dt); - p->entropy_dt = -0.5f * xp->entropy_full / dt; - } + if (p->entropy_dt < -0.5f * xp->entropy_full / dt) { + /* message("Warning! Limiting entropy_dt. Possible cooling error.\n + * entropy_full = %g \n entropy_dt * dt =%g \n", */ + /* xp->entropy_full,p->entropy_dt * dt); */ + p->entropy_dt = -0.5f * xp->entropy_full / dt; + } xp->entropy_full += p->entropy_dt * dt; /* Compute the pressure */ @@ -411,6 +412,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities( /* We read u in the entropy field. We now get S from u */ xp->entropy_full = gas_entropy_from_internal_energy(p->rho, p->entropy); p->entropy = xp->entropy_full; + /* Compute the pressure */ const float pressure = gas_pressure_from_entropy(p->rho, p->entropy); diff --git a/tests/benchmarkInteractions.c b/tests/benchmarkInteractions.c index 5a6ef60659..ee394beb3c 100644 --- a/tests/benchmarkInteractions.c +++ b/tests/benchmarkInteractions.c @@ -68,8 +68,8 @@ *separation. * @param partId The running counter of IDs. */ -struct part *make_particles(size_t count, double *offset, double spacing, double h, - long long *partId) { +struct part *make_particles(size_t count, double *offset, double spacing, + double h, long long *partId) { struct part *particles; if (posix_memalign((void **)&particles, part_align, @@ -279,7 +279,7 @@ void test_interactions(struct part test_part, struct part *parts, size_t count, } const ticks tic = getticks(); - /* Perform serial interaction */ +/* Perform serial interaction */ #ifdef __ICC #pragma novector #endif -- GitLab