### DOSELF_SUBSET, DOPAIR1_NAIVE and DOPAIR2_NAIVE should do their calculation in...

`DOSELF_SUBSET, DOPAIR1_NAIVE and DOPAIR2_NAIVE should do their calculation in the frame of the cell.`
parent 3cd6b1f8
 ... ... @@ -155,12 +155,12 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci, /* Get a hold of the ith part in ci. */ struct part *restrict pi = &parts_i[pid]; const int pi_active = part_is_active(pi, e); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; const int pi_active = part_is_active(pi, e); const double pix = {pi->x - ci->loc - shift, pi->x - ci->loc - shift, pi->x - ci->loc - shift}; const float pix = {pi->x - (ci->loc + shift), pi->x - (ci->loc + shift), pi->x - (ci->loc + shift)}; /* 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 double pjx = {pj->x - ci->loc, pj->x - ci->loc, pj->x - ci->loc}; const float pjx = {pj->x - ci->loc, pj->x - ci->loc, pj->x - ci->loc}; float dx = {pix - pjx, pix - pjx, pix - pjx}; const float r2 = dx * dx + dx * dx + dx * dx; ... ... @@ -239,25 +239,25 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci, /* Get a hold of the ith part in ci. */ struct part *restrict pi = &parts_i[pid]; const int pi_active = part_is_active(pi, e); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; const int pi_active = part_is_active(pi, e); const double pix = {pi->x - ci->loc - shift, pi->x - ci->loc - shift, pi->x - ci->loc - shift}; const float pix = {pi->x - (ci->loc + shift), pi->x - (ci->loc + shift), pi->x - (ci->loc + shift)}; /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_j; pjd++) { /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts_j[pjd]; const int pj_active = part_is_active(pj, e); const float hj = pj->h; const float hjg2 = hj * hj * kernel_gamma2; const int pj_active = part_is_active(pj, e); /* Compute the pairwise distance. */ const double pjx = {pj->x - ci->loc, pj->x - ci->loc, pj->x - ci->loc}; const float pjx = {pj->x - ci->loc, pj->x - ci->loc, pj->x - ci->loc}; float dx = {pix - pjx, pix - pjx, pix - pjx}; const float r2 = dx * dx + dx * dx + dx * dx; ... ... @@ -599,11 +599,16 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci, for (int pid = 0; pid < count; pid++) { /* Get a hold of the ith part in ci. */ struct part *restrict pi = &parts[ind[pid]]; const double pix = {pi->x, pi->x, pi->x}; struct part *pi = &parts[ind[pid]]; const float pix = {pi->x - ci->loc, pi->x - ci->loc, pi->x - ci->loc}; const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; #ifdef SWIFT_DEBUG_CHECKS if (!part_is_active(pi, e)) error("Inactive particle in subset function!"); #endif /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_i; pjd++) { ... ... @@ -611,15 +616,13 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci, struct part *restrict pj = &parts_j[pjd]; /* Compute the pairwise distance. */ float r2 = 0.0f; float dx; for (int k = 0; k < 3; k++) { dx[k] = pix[k] - pj->x[k]; r2 += dx[k] * dx[k]; } const float pjx = {pj->x - ci->loc, pj->x - ci->loc, pj->x - ci->loc}; float dx = {pix - pjx, pix - pjx, pix - pjx}; const float r2 = dx * dx + dx * dx + dx * dx; /* Hit or miss? */ if (r2 > 0.0f && r2 < hig2) { if (r2 > 0.f && r2 < hig2) { IACT_NONSYM(r2, dx, hi, pj->h, pi, pj); } ... ... @@ -719,9 +722,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 double pix = pi->x - ci->loc - shift; const double piy = pi->x - ci->loc - shift; const double piz = pi->x - ci->loc - shift; const float pix = pi->x - (ci->loc + shift); const float piy = pi->x - (ci->loc + shift); const float piz = pi->x - (ci->loc + shift); /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_j && sort_j[pjd].d < di; pjd++) { ... ... @@ -783,9 +786,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 - ci->loc - shift; const float piy = pi->x - ci->loc - shift; const float piz = pi->x - ci->loc - shift; const float pix = pi->x - (ci->loc + shift); const float piy = pi->x - (ci->loc + shift); const float piz = pi->x - (ci->loc + shift); /* Compute the pairwise distance. */ float dx = {pjx - pix, pjy - piy, pjz - piz}; ... ... @@ -968,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 - ci->loc - shift; const float piy = pi->x - ci->loc - shift; const float piz = pi->x - ci->loc - shift; const float pix = pi->x - (ci->loc + shift); const float piy = pi->x - (ci->loc + shift); const float piz = pi->x - (ci->loc + shift); /* Now loop over the relevant particles in cj */ for (int pjd = 0; pjd <= last_pj; ++pjd) { ... ... @@ -1034,9 +1037,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 - ci->loc - shift; const float piy = pi->x - ci->loc - shift; const float piz = pi->x - ci->loc - shift; const float pix = pi->x - (ci->loc + shift); const float piy = pi->x - (ci->loc + shift); const float piz = pi->x - (ci->loc + shift); /* Compute the pairwise distance. */ float dx = {pjx - pix, pjy - piy, pjz - piz}; ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment