From d651d25fec9d32337deb43ad218e7450d5757877 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Wed, 7 Sep 2016 21:33:25 +0100 Subject: [PATCH] Apply code formatting script. Remove unnecessary guards in the equation of state file. --- src/engine.c | 9 ++++----- src/equation_of_state.h | 4 +--- src/runner.c | 18 ++++++++++-------- src/sourceterms/sn_feedback/sn_feedback.h | 1 - src/task.c | 10 +++++----- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/engine.c b/src/engine.c index 478af7a508..ecf5013238 100644 --- a/src/engine.c +++ b/src/engine.c @@ -158,7 +158,6 @@ void engine_make_gravity_hierarchical_tasks(struct engine *e, struct cell *c, if (is_with_external_gravity) c->grav_external = scheduler_addtask( s, task_type_grav_external, task_subtype_none, 0, 0, c, NULL, 0); - } } @@ -1796,10 +1795,10 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) { else if (t->type == task_type_grav_external) { scheduler_addunlock(sched, t->ci->init, t); scheduler_addunlock(sched, t, t->ci->kick); - } - /* source terms depend on kick (should eventually depend on cooling) */ - else if (t->type == task_type_sourceterms) { - scheduler_addunlock(sched, t->ci->kick, t); + } + /* source terms depend on kick (should eventually depend on cooling) */ + else if (t->type == task_type_sourceterms) { + scheduler_addunlock(sched, t->ci->kick, t); } /* Cooling tasks should depend on kick and does not unlock anything since diff --git a/src/equation_of_state.h b/src/equation_of_state.h index ec418f4c02..af59d8a2ca 100644 --- a/src/equation_of_state.h +++ b/src/equation_of_state.h @@ -40,9 +40,7 @@ /* ------------------------------------------------------------------------- */ #if defined(EOS_IDEAL_GAS) -#if defined(EOS_ISOTHERMAL_GAS) -#error cannot have both! -#endif + /** * @brief Returns the internal energy given density and entropy * diff --git a/src/runner.c b/src/runner.c index 07b874c94a..ccd2a71def 100644 --- a/src/runner.c +++ b/src/runner.c @@ -48,12 +48,12 @@ #include "engine.h" #include "error.h" #include "gravity.h" -#include "sourceterms.h" #include "hydro.h" #include "hydro_properties.h" #include "kick.h" #include "minmax.h" #include "scheduler.h" +#include "sourceterms.h" #include "space.h" #include "task.h" #include "timers.h" @@ -123,12 +123,14 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) { struct part *restrict parts = c->parts; const int count = c->count; - const double cell_min[3] = {c->loc[0], c->loc[1], c->loc[2]}; + const double cell_min[3] = {c->loc[0], c->loc[1], c->loc[2]}; const double cell_width[3] = {c->width[0], c->width[1], c->width[2]}; const int ti_current = r->e->ti_current; const struct sourceterms *sourceterms = r->e->sourceterms; - const double location[3] = {sourceterms->supernova.x, sourceterms->supernova.y, sourceterms->supernova.z}; - const int dimen=3; + const double location[3] = {sourceterms->supernova.x, + sourceterms->supernova.y, + sourceterms->supernova.z}; + const int dimen = 3; const double timeBase = r->e->timeBase; TIMER_TIC; @@ -141,7 +143,7 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) { } /* does cell contain explosion? */ - if(count > 0) { + if (count > 0) { const int incell = is_in_cell(cell_min, cell_width, location, dimen); if (incell == 1) { @@ -152,7 +154,7 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) { /* Get a direct pointer on the part. */ struct part *restrict p = &parts[i]; - if(p->id > imax) { + if (p->id > imax) { imax = p->id; sn_part = p; } @@ -163,8 +165,8 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) { /* Does this time step straddle the feedback injection time? */ const float t_begin = sn_part->ti_begin * timeBase; - const float t_end = sn_part->ti_end * timeBase; - if (t_begin <= sourceterms->supernova.time && + const float t_end = sn_part->ti_end * timeBase; + if (t_begin <= sourceterms->supernova.time && t_end > sourceterms->supernova.time) { do_supernova_feedback(sourceterms, sn_part); } diff --git a/src/sourceterms/sn_feedback/sn_feedback.h b/src/sourceterms/sn_feedback/sn_feedback.h index 2cb05d5a43..2aef4d7a22 100644 --- a/src/sourceterms/sn_feedback/sn_feedback.h +++ b/src/sourceterms/sn_feedback/sn_feedback.h @@ -43,6 +43,5 @@ __attribute__((always_inline)) INLINE static void do_supernova_feedback( const float u_old = hydro_get_internal_energy(p, 0); const float u_new = u_old + sourceterms->supernova.energy / hydro_get_mass(p); hydro_set_internal_energy(p, u_new); - }; #endif /* SWIFT_SN_FEEDBACK_H */ diff --git a/src/task.c b/src/task.c index f4864e7077..18197f9c5f 100644 --- a/src/task.c +++ b/src/task.c @@ -48,10 +48,10 @@ /* Task type names. */ const char *taskID_names[task_type_count] = { - "none", "sort", "self", "pair", "sub_self", - "sub_pair", "init", "ghost", "extra_ghost", "kick", - "kick_fixdt", "send", "recv", "grav_gather_m", "grav_fft", - "grav_mm", "grav_up", "grav_external", "cooling", "sourceterms"}; + "none", "sort", "self", "pair", "sub_self", + "sub_pair", "init", "ghost", "extra_ghost", "kick", + "kick_fixdt", "send", "recv", "grav_gather_m", "grav_fft", + "grav_mm", "grav_up", "grav_external", "cooling", "sourceterms"}; const char *subtaskID_names[task_subtype_count] = { "none", "density", "gradient", "force", "grav", "tend"}; @@ -118,7 +118,7 @@ __attribute__((always_inline)) INLINE static enum task_actions task_acts_on( case task_type_ghost: case task_type_extra_ghost: case task_type_cooling: - case task_type_sourceterms: + case task_type_sourceterms: return task_action_part; break; -- GitLab