Skip to content
Snippets Groups Projects
Commit ae163756 authored by James Willis's avatar James Willis
Browse files

Compute shift for ci particles before loop.

parent 9b08543b
No related branches found
No related tags found
1 merge request!407Patch vecorised pair interactions
...@@ -240,6 +240,12 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted( ...@@ -240,6 +240,12 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
loc[1] = ci->loc[1]; loc[1] = ci->loc[1];
loc[2] = ci->loc[2]; loc[2] = ci->loc[2];
/* Shift ci particles for boundary conditions and location of cell.*/
double total_ci_shift[3];
total_ci_shift[0] = loc[0] - shift[0];
total_ci_shift[1] = loc[1] - shift[1];
total_ci_shift[2] = loc[2] - shift[2];
/* Let the compiler know that the data is aligned and create pointers to the /* Let the compiler know that the data is aligned and create pointers to the
* arrays inside the cache. */ * arrays inside the cache. */
swift_declare_aligned_ptr(float, x, ci_cache->x, SWIFT_CACHE_ALIGNMENT); swift_declare_aligned_ptr(float, x, ci_cache->x, SWIFT_CACHE_ALIGNMENT);
...@@ -260,9 +266,9 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted( ...@@ -260,9 +266,9 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
* due to BCs but leave cell cj. */ * due to BCs but leave cell cj. */
for (int i = 0; i < ci_cache_count; i++) { for (int i = 0; i < ci_cache_count; i++) {
idx = sort_i[i + first_pi_align].i; idx = sort_i[i + first_pi_align].i;
x[i] = (float)(parts_i[idx].x[0] - loc[0] - shift[0]); x[i] = (float)(parts_i[idx].x[0] - total_ci_shift[0]);
y[i] = (float)(parts_i[idx].x[1] - loc[1] - shift[1]); y[i] = (float)(parts_i[idx].x[1] - total_ci_shift[1]);
z[i] = (float)(parts_i[idx].x[2] - loc[2] - shift[2]); z[i] = (float)(parts_i[idx].x[2] - total_ci_shift[2]);
h[i] = parts_i[idx].h; h[i] = parts_i[idx].h;
m[i] = parts_i[idx].mass; m[i] = parts_i[idx].mass;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment