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

Apply code formatting script. Remove unnecessary guards in the equation of state file.

parent 0d969cd4
...@@ -158,7 +158,6 @@ void engine_make_gravity_hierarchical_tasks(struct engine *e, struct cell *c, ...@@ -158,7 +158,6 @@ void engine_make_gravity_hierarchical_tasks(struct engine *e, struct cell *c,
if (is_with_external_gravity) if (is_with_external_gravity)
c->grav_external = scheduler_addtask( c->grav_external = scheduler_addtask(
s, task_type_grav_external, task_subtype_none, 0, 0, c, NULL, 0); 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) { ...@@ -1796,10 +1795,10 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
else if (t->type == task_type_grav_external) { else if (t->type == task_type_grav_external) {
scheduler_addunlock(sched, t->ci->init, t); scheduler_addunlock(sched, t->ci->init, t);
scheduler_addunlock(sched, t, t->ci->kick); scheduler_addunlock(sched, t, t->ci->kick);
} }
/* source terms depend on kick (should eventually depend on cooling) */ /* source terms depend on kick (should eventually depend on cooling) */
else if (t->type == task_type_sourceterms) { else if (t->type == task_type_sourceterms) {
scheduler_addunlock(sched, t->ci->kick, t); scheduler_addunlock(sched, t->ci->kick, t);
} }
/* Cooling tasks should depend on kick and does not unlock anything since /* Cooling tasks should depend on kick and does not unlock anything since
......
...@@ -40,9 +40,7 @@ ...@@ -40,9 +40,7 @@
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#if defined(EOS_IDEAL_GAS) #if defined(EOS_IDEAL_GAS)
#if defined(EOS_ISOTHERMAL_GAS)
#error cannot have both!
#endif
/** /**
* @brief Returns the internal energy given density and entropy * @brief Returns the internal energy given density and entropy
* *
......
...@@ -48,12 +48,12 @@ ...@@ -48,12 +48,12 @@
#include "engine.h" #include "engine.h"
#include "error.h" #include "error.h"
#include "gravity.h" #include "gravity.h"
#include "sourceterms.h"
#include "hydro.h" #include "hydro.h"
#include "hydro_properties.h" #include "hydro_properties.h"
#include "kick.h" #include "kick.h"
#include "minmax.h" #include "minmax.h"
#include "scheduler.h" #include "scheduler.h"
#include "sourceterms.h"
#include "space.h" #include "space.h"
#include "task.h" #include "task.h"
#include "timers.h" #include "timers.h"
...@@ -123,12 +123,14 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) { ...@@ -123,12 +123,14 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) {
struct part *restrict parts = c->parts; struct part *restrict parts = c->parts;
const int count = c->count; 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 double cell_width[3] = {c->width[0], c->width[1], c->width[2]};
const int ti_current = r->e->ti_current; const int ti_current = r->e->ti_current;
const struct sourceterms *sourceterms = r->e->sourceterms; const struct sourceterms *sourceterms = r->e->sourceterms;
const double location[3] = {sourceterms->supernova.x, sourceterms->supernova.y, sourceterms->supernova.z}; const double location[3] = {sourceterms->supernova.x,
const int dimen=3; sourceterms->supernova.y,
sourceterms->supernova.z};
const int dimen = 3;
const double timeBase = r->e->timeBase; const double timeBase = r->e->timeBase;
TIMER_TIC; TIMER_TIC;
...@@ -141,7 +143,7 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) { ...@@ -141,7 +143,7 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) {
} }
/* does cell contain explosion? */ /* does cell contain explosion? */
if(count > 0) { if (count > 0) {
const int incell = is_in_cell(cell_min, cell_width, location, dimen); const int incell = is_in_cell(cell_min, cell_width, location, dimen);
if (incell == 1) { if (incell == 1) {
...@@ -152,7 +154,7 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) { ...@@ -152,7 +154,7 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) {
/* Get a direct pointer on the part. */ /* Get a direct pointer on the part. */
struct part *restrict p = &parts[i]; struct part *restrict p = &parts[i];
if(p->id > imax) { if (p->id > imax) {
imax = p->id; imax = p->id;
sn_part = p; sn_part = p;
} }
...@@ -163,8 +165,8 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) { ...@@ -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? */ /* Does this time step straddle the feedback injection time? */
const float t_begin = sn_part->ti_begin * timeBase; const float t_begin = sn_part->ti_begin * timeBase;
const float t_end = sn_part->ti_end * timeBase; const float t_end = sn_part->ti_end * timeBase;
if (t_begin <= sourceterms->supernova.time && if (t_begin <= sourceterms->supernova.time &&
t_end > sourceterms->supernova.time) { t_end > sourceterms->supernova.time) {
do_supernova_feedback(sourceterms, sn_part); do_supernova_feedback(sourceterms, sn_part);
} }
......
...@@ -43,6 +43,5 @@ __attribute__((always_inline)) INLINE static void do_supernova_feedback( ...@@ -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_old = hydro_get_internal_energy(p, 0);
const float u_new = u_old + sourceterms->supernova.energy / hydro_get_mass(p); const float u_new = u_old + sourceterms->supernova.energy / hydro_get_mass(p);
hydro_set_internal_energy(p, u_new); hydro_set_internal_energy(p, u_new);
}; };
#endif /* SWIFT_SN_FEEDBACK_H */ #endif /* SWIFT_SN_FEEDBACK_H */
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
/* Task type names. */ /* Task type names. */
const char *taskID_names[task_type_count] = { const char *taskID_names[task_type_count] = {
"none", "sort", "self", "pair", "sub_self", "none", "sort", "self", "pair", "sub_self",
"sub_pair", "init", "ghost", "extra_ghost", "kick", "sub_pair", "init", "ghost", "extra_ghost", "kick",
"kick_fixdt", "send", "recv", "grav_gather_m", "grav_fft", "kick_fixdt", "send", "recv", "grav_gather_m", "grav_fft",
"grav_mm", "grav_up", "grav_external", "cooling", "sourceterms"}; "grav_mm", "grav_up", "grav_external", "cooling", "sourceterms"};
const char *subtaskID_names[task_subtype_count] = { const char *subtaskID_names[task_subtype_count] = {
"none", "density", "gradient", "force", "grav", "tend"}; "none", "density", "gradient", "force", "grav", "tend"};
...@@ -118,7 +118,7 @@ __attribute__((always_inline)) INLINE static enum task_actions task_acts_on( ...@@ -118,7 +118,7 @@ __attribute__((always_inline)) INLINE static enum task_actions task_acts_on(
case task_type_ghost: case task_type_ghost:
case task_type_extra_ghost: case task_type_extra_ghost:
case task_type_cooling: case task_type_cooling:
case task_type_sourceterms: case task_type_sourceterms:
return task_action_part; return task_action_part;
break; break;
......
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