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

Skip particles inside the same group earlier when performing a FOF search on a single cell.

parent 579e205a
No related branches found
No related tags found
1 merge request!543Fof
...@@ -282,6 +282,12 @@ void fof_search_cell(struct space *s, struct cell *c) { ...@@ -282,6 +282,12 @@ void fof_search_cell(struct space *s, struct cell *c) {
for (size_t j = i + 1; j < count; j++) { for (size_t j = i + 1; j < count; j++) {
/* Find the root of pj. */
const int root_j = fof_find(offset[j], group_id);
/* Skip particles in the same group. */
if (root_i == root_j) continue;
struct gpart *pj = &gparts[j]; struct gpart *pj = &gparts[j];
const double pjx = pj->x[0]; const double pjx = pj->x[0];
const double pjy = pj->x[1]; const double pjy = pj->x[1];
...@@ -299,12 +305,6 @@ void fof_search_cell(struct space *s, struct cell *c) { ...@@ -299,12 +305,6 @@ void fof_search_cell(struct space *s, struct cell *c) {
r2 += dx[k] * dx[k]; r2 += dx[k] * dx[k];
} }
/* Find the root of pj. */
const int root_j = fof_find(offset[j], group_id);
/* Skip particles in the same group. */
if (root_i == root_j) continue;
/* Hit or miss? */ /* Hit or miss? */
if (r2 < l_x2) { if (r2 < l_x2) {
...@@ -368,20 +368,19 @@ void fof_search_pair_cells(struct space *s, struct cell *ci, struct cell *cj) { ...@@ -368,20 +368,19 @@ void fof_search_pair_cells(struct space *s, struct cell *ci, struct cell *cj) {
for (size_t j = 0; j < count_j; j++) { for (size_t j = 0; j < count_j; j++) {
struct gpart *pj = &gparts_j[j];
/* Find the root of pj. */ /* Find the root of pj. */
const int root_j = fof_find(offset_j[j], group_id); const int root_j = fof_find(offset_j[j], group_id);
/* Skip particles in the same group. */ /* Skip particles in the same group. */
if (root_i == root_j) continue; if (root_i == root_j) continue;
/* Compute pairwise distance, remembering to account for boundary struct gpart *pj = &gparts_j[j];
* conditions. */
const double pjx = pj->x[0]; const double pjx = pj->x[0];
const double pjy = pj->x[1]; const double pjy = pj->x[1];
const double pjz = pj->x[2]; const double pjz = pj->x[2];
/* Compute pairwise distance, remembering to account for boundary
* conditions. */
float dx[3], r2 = 0.0f; float dx[3], r2 = 0.0f;
dx[0] = pix - pjx; dx[0] = pix - pjx;
dx[1] = piy - pjy; dx[1] = piy - pjy;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment