From dd260c6a320eaabdaa0fbcd5a2113b40a452c153 Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Fri, 15 Dec 2017 17:00:48 +0000 Subject: [PATCH] Pad subpair cache. --- src/cache.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/cache.h b/src/cache.h index 164abc9217..f0884566a6 100644 --- a/src/cache.h +++ b/src/cache.h @@ -239,7 +239,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subpair( /* 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++) { - const int idx = sort_i[i].i; + const int idx = i;//sort_i[i].i; x[i] = (float)(parts[idx].x[0] - loc[0]); y[i] = (float)(parts[idx].x[1] - loc[1]); z[i] = (float)(parts[idx].x[2] - loc[2]); @@ -250,6 +250,23 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subpair( vz[i] = parts[idx].v[2]; } + const double max_dx = ci->dx_max_part; + const float pos_padded[3] = {-(2. * ci->width[0] + max_dx), + -(2. * ci->width[1] + max_dx), + -(2. * ci->width[2] + max_dx)}; + const float h_padded = ci->parts[0].h; + + for (int i = ci->count; i < ci->count + VEC_SIZE; i++) { + x[i] = pos_padded[0]; + y[i] = pos_padded[1]; + z[i] = pos_padded[2]; + h[i] = h_padded; + + m[i] = 1.f; + vx[i] = 1.f; + vy[i] = 1.f; + vz[i] = 1.f; + } #endif } -- GitLab