Commit 68c14b0c authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added better way of controling what loop we are in at the pre-processor level.

parent 4e026b8e
......@@ -64,31 +64,33 @@
#include "timers.h"
#include "timestep.h"
#define DENSITY 0
#define GRADIENT 1
#define FORCE 2
#define LIMITER 3
#define TASK_LOOP_DENSITY 0
#define TASK_LOOP_GRADIENT 1
#define TASK_LOOP_FORCE 2
#define TASK_LOOP_LIMITER 3
/* Import the density loop functions. */
#define FUNCTION density
#define FUNCTION_NUM DENSITY
#define FUNCTION_TASK_LOOP TASK_LOOP_DENSITY
#include "runner_doiact.h"
#undef FUNCTION
#undef FUNCTION_TASK_LOOP
/* Import the gradient loop functions (if required). */
#ifdef EXTRA_HYDRO_LOOP
#undef FUNCTION
#undef FUNCTION_NUM
#define FUNCTION gradient
#define FUNCTION_NUM GRADIENT
#define FUNCTION_TASK_LOOP TASK_LOOP_GRADIENT
#include "runner_doiact.h"
#undef FUNCTION
#undef FUNCTION_TASK_LOOP
#endif
/* Import the force loop functions. */
#undef FUNCTION
#undef FUNCTION_NUM
#define FUNCTION force
#define FUNCTION_NUM FORCE
#define FUNCTION_TASK_LOOP TASK_LOOP_FORCE
#include "runner_doiact.h"
#undef FUNCTION
#undef FUNCTION_TASK_LOOP
/* Import the gravity loop functions. */
#include "runner_doiact_fft.h"
......
......@@ -1086,7 +1086,8 @@ void DOPAIR1_BRANCH(struct runner *r, struct cell *ci, struct cell *cj) {
#if defined(SWIFT_USE_NAIVE_INTERACTIONS)
DOPAIR1_NAIVE(r, ci, cj);
#elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && (FUNCTION_NUM == DENSITY)
#elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && \
(FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
if (!sort_is_corner(sid))
runner_dopair1_density_vec(r, ci, cj, sid, shift);
else
......@@ -1571,7 +1572,8 @@ void DOPAIR2_BRANCH(struct runner *r, struct cell *ci, struct cell *cj) {
#ifdef SWIFT_USE_NAIVE_INTERACTIONS
DOPAIR2_NAIVE(r, ci, cj);
#elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && (FUNCTION_NUM == FORCE)
#elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && \
(FUNCTION_TASK_LOOP == TASK_LOOP_FORCE)
if (!sort_is_corner(sid))
runner_dopair2_force_vec(r, ci, cj, sid, shift);
else
......@@ -1733,7 +1735,8 @@ void DOSELF1_BRANCH(struct runner *r, struct cell *c) {
#if defined(SWIFT_USE_NAIVE_INTERACTIONS)
DOSELF1_NAIVE(r, c);
#elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && (FUNCTION_NUM == DENSITY)
#elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && \
(FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_doself1_density_vec(r, c);
#else
DOSELF1(r, c);
......@@ -1884,7 +1887,8 @@ void DOSELF2_BRANCH(struct runner *r, struct cell *c) {
#if defined(SWIFT_USE_NAIVE_INTERACTIONS)
DOSELF2_NAIVE(r, c);
#elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH)
#elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && \
(FUNCTION_TASK_LOOP == TASK_LOOP_FORCE)
runner_doself2_force_vec(r, c);
#else
DOSELF2(r, c);
......
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