diff --git a/src/runner.c b/src/runner.c index dd3f3c8e4e59af15485ece16665ffdae85703117..333d1519c2774d2544b4cf29d29fab3289bda8ec 100644 --- a/src/runner.c +++ b/src/runner.c @@ -670,8 +670,8 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { for (int i = 0; i < count; i++) { /* Get a direct pointer on the part. */ - struct part *restrict p = &parts[pid[i]]; - struct xpart *restrict xp = &xparts[pid[i]]; + struct part *p = &parts[pid[i]]; + struct xpart *xp = &xparts[pid[i]]; #ifdef SWIFT_DEBUG_CHECKS /* Is this part within the timestep? */ diff --git a/src/runner_doiact.h b/src/runner_doiact.h index d2415603533bc101067f9b4f5f51aad4ba085065..7c97e8512d92425f5d6502d0cad625702aeca19e 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -158,9 +158,9 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci, const int pi_active = part_is_active(pi, e); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; - const float pix[3] = {pi->x[0] - (ci->loc[0] + shift[0]), - pi->x[1] - (ci->loc[1] + shift[1]), - pi->x[2] - (ci->loc[2] + shift[2])}; + const float pix[3] = {pi->x[0] - (cj->loc[0] + shift[0]), + pi->x[1] - (cj->loc[1] + shift[1]), + pi->x[2] - (cj->loc[2] + shift[2])}; /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_j; pjd++) { @@ -172,8 +172,8 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci, const int pj_active = part_is_active(pj, e); /* Compute the pairwise distance. */ - const float pjx[3] = {pj->x[0] - ci->loc[0], pj->x[1] - ci->loc[1], - pj->x[2] - ci->loc[2]}; + const float pjx[3] = {pj->x[0] - cj->loc[0], pj->x[1] - cj->loc[1], + pj->x[2] - cj->loc[2]}; float dx[3] = {pix[0] - pjx[0], pix[1] - pjx[1], pix[2] - pjx[2]}; const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; @@ -242,9 +242,9 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci, const int pi_active = part_is_active(pi, e); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; - const float pix[3] = {pi->x[0] - (ci->loc[0] + shift[0]), - pi->x[1] - (ci->loc[1] + shift[1]), - pi->x[2] - (ci->loc[2] + shift[2])}; + const float pix[3] = {pi->x[0] - (cj->loc[0] + shift[0]), + pi->x[1] - (cj->loc[1] + shift[1]), + pi->x[2] - (cj->loc[2] + shift[2])}; /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_j; pjd++) { @@ -256,8 +256,8 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci, const float hjg2 = hj * hj * kernel_gamma2; /* Compute the pairwise distance. */ - const float pjx[3] = {pj->x[0] - ci->loc[0], pj->x[1] - ci->loc[1], - pj->x[2] - ci->loc[2]}; + const float pjx[3] = {pj->x[0] - cj->loc[0], pj->x[1] - cj->loc[1], + pj->x[2] - cj->loc[2]}; float dx[3] = {pix[0] - pjx[0], pix[1] - pjx[1], pix[2] - pjx[2]}; const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; @@ -509,8 +509,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci, const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; const double di = hi * kernel_gamma + dxj + pix * runner_shift[sid][0] + - piy * runner_shift[sid][1] + - piz * runner_shift[sid][2]; + piy * runner_shift[sid][1] + piz * runner_shift[sid][2]; /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_j && sort_j[pjd].d < di; pjd++) { @@ -548,9 +547,8 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci, const double piz = pi->x[2] - (shift[2]); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; - const double di = - -hi * kernel_gamma - dxj + pix * runner_shift[sid][0] + - piy * runner_shift[sid][1] + piz * runner_shift[sid][2]; + const double di = -hi * kernel_gamma - dxj + pix * runner_shift[sid][0] + + piy * runner_shift[sid][1] + piz * runner_shift[sid][2]; /* Loop over the parts in cj. */ for (int pjd = count_j - 1; pjd >= 0 && di < sort_j[pjd].d; pjd--) { @@ -603,8 +601,8 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci, /* Get a hold of the ith part in ci. */ struct part *pi = &parts[ind[pid]]; - const float pix[3] = {pi->x[0] - ci->loc[0], pi->x[1] - ci->loc[1], - pi->x[2] - ci->loc[2]}; + const float pix[3] = {pi->x[0] - cj->loc[0], pi->x[1] - cj->loc[1], + pi->x[2] - cj->loc[2]}; const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; @@ -619,8 +617,8 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci, struct part *restrict pj = &parts_j[pjd]; /* Compute the pairwise distance. */ - const float pjx[3] = {pj->x[0] - ci->loc[0], pj->x[1] - ci->loc[1], - pj->x[2] - ci->loc[2]}; + const float pjx[3] = {pj->x[0] - cj->loc[0], pj->x[1] - cj->loc[1], + pj->x[2] - cj->loc[2]}; float dx[3] = {pix[0] - pjx[0], pix[1] - pjx[1], pix[2] - pjx[2]}; const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; @@ -725,9 +723,9 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Get some additional information about pi */ const float hig2 = hi * hi * kernel_gamma2; - const float pix = pi->x[0] - (ci->loc[0] + shift[0]); - const float piy = pi->x[1] - (ci->loc[1] + shift[1]); - const float piz = pi->x[2] - (ci->loc[2] + shift[2]); + const float pix = pi->x[0] - (cj->loc[0] + shift[0]); + const float piy = pi->x[1] - (cj->loc[1] + shift[1]); + const float piz = pi->x[2] - (cj->loc[2] + shift[2]); /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_j && sort_j[pjd].d < di; pjd++) { @@ -735,9 +733,9 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Recover pj */ struct part *pj = &parts_j[sort_j[pjd].i]; const float hj = pj->h; - const float pjx = pj->x[0] - ci->loc[0]; - const float pjy = pj->x[1] - ci->loc[1]; - const float pjz = pj->x[2] - ci->loc[2]; + const float pjx = pj->x[0] - cj->loc[0]; + const float pjy = pj->x[1] - cj->loc[1]; + const float pjz = pj->x[2] - cj->loc[2]; /* Compute the pairwise distance. */ float dx[3] = {pix - pjx, piy - pjy, piz - pjz}; @@ -779,9 +777,9 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Get some additional information about pj */ const float hjg2 = hj * hj * kernel_gamma2; - const float pjx = pj->x[0] - ci->loc[0]; - const float pjy = pj->x[1] - ci->loc[1]; - const float pjz = pj->x[2] - ci->loc[2]; + const float pjx = pj->x[0] - cj->loc[0]; + const float pjy = pj->x[1] - cj->loc[1]; + const float pjz = pj->x[2] - cj->loc[2]; /* Loop over the parts in ci. */ for (int pid = count_i - 1; pid >= 0 && sort_i[pid].d > dj; pid--) { @@ -789,9 +787,9 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Recover pi */ struct part *pi = &parts_i[sort_i[pid].i]; const float hi = pi->h; - const float pix = pi->x[0] - (ci->loc[0] + shift[0]); - const float piy = pi->x[1] - (ci->loc[1] + shift[1]); - const float piz = pi->x[2] - (ci->loc[2] + shift[2]); + const float pix = pi->x[0] - (cj->loc[0] + shift[0]); + const float piy = pi->x[1] - (cj->loc[1] + shift[1]); + const float piz = pi->x[2] - (cj->loc[2] + shift[2]); /* Compute the pairwise distance. */ float dx[3] = {pjx - pix, pjy - piy, pjz - piz}; @@ -973,9 +971,9 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { /* Get some additional information about pi */ const float hig2 = hi * hi * kernel_gamma2; - const float pix = pi->x[0] - (ci->loc[0] + shift[0]); - const float piy = pi->x[1] - (ci->loc[1] + shift[1]); - const float piz = pi->x[2] - (ci->loc[2] + shift[2]); + const float pix = pi->x[0] - (cj->loc[0] + shift[0]); + const float piy = pi->x[1] - (cj->loc[1] + shift[1]); + const float piz = pi->x[2] - (cj->loc[2] + shift[2]); /* Now loop over the relevant particles in cj */ for (int pjd = 0; pjd <= last_pj; ++pjd) { @@ -984,9 +982,9 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { struct part *pj = &parts_j[sort_j[pjd].i]; const float hj = pj->h; const float hjg2 = hj * hj * kernel_gamma2; - const float pjx = pj->x[0] - ci->loc[0]; - const float pjy = pj->x[1] - ci->loc[1]; - const float pjz = pj->x[2] - ci->loc[2]; + const float pjx = pj->x[0] - cj->loc[0]; + const float pjy = pj->x[1] - cj->loc[1]; + const float pjz = pj->x[2] - cj->loc[2]; /* Compute the pairwise distance. */ float dx[3] = {pix - pjx, piy - pjy, piz - pjz}; @@ -1027,9 +1025,9 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { /* Get some additional information about pj */ const float hjg2 = hj * hj * kernel_gamma2; - const float pjx = pj->x[0] - ci->loc[0]; - const float pjy = pj->x[1] - ci->loc[1]; - const float pjz = pj->x[2] - ci->loc[2]; + const float pjx = pj->x[0] - cj->loc[0]; + const float pjy = pj->x[1] - cj->loc[1]; + const float pjz = pj->x[2] - cj->loc[2]; /* Now loop over the relevant particles in ci */ for (int pid = count_i - 1; pid >= first_pi; --pid) { @@ -1038,9 +1036,9 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { struct part *pi = &parts_i[sort_i[pid].i]; const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; - const float pix = pi->x[0] - (ci->loc[0] + shift[0]); - const float piy = pi->x[1] - (ci->loc[1] + shift[1]); - const float piz = pi->x[2] - (ci->loc[2] + shift[2]); + const float pix = pi->x[0] - (cj->loc[0] + shift[0]); + const float piy = pi->x[1] - (cj->loc[1] + shift[1]); + const float piz = pi->x[2] - (cj->loc[2] + shift[2]); /* Compute the pairwise distance. */ float dx[3] = {pjx - pix, pjy - piy, pjz - piz};