diff --git a/src/task.c b/src/task.c index e9404ab00df4f757f49d6d186f28dc40c49cfa01..a30ac329e27a3d0f5170f60cf7ebaf0920fa6b20 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 ee49568b143282b9e3025f6d2bc81ded04ffee41..a7cbf28c3d1c7bde45102e5ce85e18c5f736e343 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 f32a699f6338362c3de247e5a5abc419b9547374..99747484b2fad2d1dfadad749232f77848e56f35 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); }