diff --git a/src/cache.h b/src/cache.h index 164abc9217aaa5ffa47023d6df0c915dee39faae..f0884566a64b347ae2d37a4e517699eaaf80639f 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 }