diff --git a/src/cache.h b/src/cache.h index a6a7090806f27c038eef562fa654b19a24103560..6332f1470564a3a0869b851bd7cd9853d922c143 100644 --- a/src/cache.h +++ b/src/cache.h @@ -143,6 +143,8 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c, __attribute__((always_inline)) INLINE void cache_read_particles( const struct cell *const ci, struct cache *const ci_cache) { +#if defined(GADGET2_SPH) + /* Shift the particles positions to a local frame so single precision can be * used instead of double precision. */ for (int i = 0; i < ci->count; i++) { @@ -156,6 +158,8 @@ __attribute__((always_inline)) INLINE void cache_read_particles( ci_cache->vy[i] = ci->parts[i].v[1]; ci_cache->vz[i] = ci->parts[i].v[2]; } + +#endif } #endif /* SWIFT_CACHE_H */ diff --git a/src/runner.c b/src/runner.c index 23e5c8d2d920023394f466c60deec821bca4d332..466fab4c5a47bbc6b4eda314a9d7b7a6e75d97d3 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1095,7 +1095,7 @@ void *runner_main(void *data) { switch (t->type) { case task_type_self: if (t->subtype == task_subtype_density) { -#ifdef WITH_VECTORIZATION +#if defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) runner_doself1_density_vec(r, ci); #else runner_doself1_density(r, ci); diff --git a/src/tools.c b/src/tools.c index f4cb86744332dd211ac07e366cd048049b2068bd..ab11d1f5930cf5319aaf6424f1559f144718e154 100644 --- a/src/tools.c +++ b/src/tools.c @@ -600,6 +600,9 @@ int compare_values(double a, double b, double threshold, double *absDiff, * @return 1 if difference found, 0 otherwise */ int compare_particles(struct part a, struct part b, double threshold) { + +#ifdef GADGET2_SPH + int result = 0; double absDiff = 0.0, absSum = 0.0, relDiff = 0.0; @@ -720,6 +723,13 @@ int compare_particles(struct part a, struct part b, double threshold) { } return result; + +#else + + error("Function not supported for this flavour of SPH"); + return 0; + +#endif } /** @brief Computes the forces between all g-particles using the N^2 algorithm