From 0ddb59fc0b0e8d7101cf3a69e6e4aa8ecbc770dd Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Fri, 5 Aug 2016 17:09:49 +0100 Subject: [PATCH] Don't use the self-gravity time-step criterion yet as we don't have appropriate softening lenghts --- src/task.c | 16 +++++++++++++--- src/task.h | 1 - src/timestep.h | 5 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/task.c b/src/task.c index e9404ab00d..a30ac329e2 100644 --- a/src/task.c +++ b/src/task.c @@ -43,6 +43,7 @@ /* Local headers. */ #include "atomic.h" #include "error.h" +#include "inline.h" #include "lock.h" /* Task type names. */ @@ -59,8 +60,11 @@ const char *subtaskID_names[task_type_count] = {"none", "density", "force", /** * @brief Computes the overlap between the parts array of two given cells. */ -size_t task_cell_overlap_part(const struct cell *ci, const struct cell *cj) { +__attribute__((always_inline)) INLINE static size_t task_cell_overlap_part( + const struct cell *ci, const struct cell *cj) { + if (ci == NULL || cj == NULL) return 0; + if (ci->parts <= cj->parts && ci->parts + ci->count >= cj->parts + cj->count) { return cj->count; @@ -68,14 +72,18 @@ size_t task_cell_overlap_part(const struct cell *ci, const struct cell *cj) { cj->parts + cj->count >= ci->parts + ci->count) { return ci->count; } + return 0; } /** * @brief Computes the overlap between the gparts array of two given cells. */ -size_t task_cell_overlap_gpart(const struct cell *ci, const struct cell *cj) { +__attribute__((always_inline)) INLINE static size_t task_cell_overlap_gpart( + const struct cell *ci, const struct cell *cj) { + if (ci == NULL || cj == NULL) return 0; + if (ci->gparts <= cj->gparts && ci->gparts + ci->gcount >= cj->gparts + cj->gcount) { return cj->gcount; @@ -83,6 +91,7 @@ size_t task_cell_overlap_gpart(const struct cell *ci, const struct cell *cj) { cj->gparts + cj->gcount >= ci->gparts + ci->gcount) { return ci->gcount; } + return 0; } @@ -91,7 +100,8 @@ size_t task_cell_overlap_gpart(const struct cell *ci, const struct cell *cj) { * * @param t The #task. */ -enum task_actions task_acts_on(const struct task *t) { +__attribute__((always_inline)) INLINE static enum task_actions task_acts_on( + const struct task *t) { switch (t->type) { diff --git a/src/task.h b/src/task.h index ee49568b14..a7cbf28c3d 100644 --- a/src/task.h +++ b/src/task.h @@ -112,6 +112,5 @@ int task_lock(struct task *t); void task_print_mask(unsigned int mask); void task_print_submask(unsigned int submask); void task_do_rewait(struct task *t); -enum task_actions task_acts_on(const struct task *t); #endif /* SWIFT_TASK_H */ diff --git a/src/timestep.h b/src/timestep.h index f32a699f63..99747484b2 100644 --- a/src/timestep.h +++ b/src/timestep.h @@ -106,8 +106,9 @@ __attribute__((always_inline)) INLINE static int get_part_timestep( const float new_dt_external = gravity_compute_timestep_external( e->external_potential, e->physical_constants, p->gpart); - const float new_dt_self = - gravity_compute_timestep_self(e->physical_constants, p->gpart); + /* const float new_dt_self = */ + /* gravity_compute_timestep_self(e->physical_constants, p->gpart); */ + const float new_dt_self = FLT_MAX; // MATTHIEU new_dt_grav = fminf(new_dt_external, new_dt_self); } -- GitLab