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

Remove/add the total number found in the group when reassigning group roots.

parent 831f95a4
No related branches found
No related tags found
1 merge request!543Fof
...@@ -196,13 +196,13 @@ void fof_search_serial(struct space *s) { ...@@ -196,13 +196,13 @@ void fof_search_serial(struct space *s) {
if(root_j < root_i) { if(root_j < root_i) {
pid[root_i] = root_j; pid[root_i] = root_j;
num_in_groups[root_i]--; num_in_groups[root_j] += num_in_groups[root_i];
num_in_groups[root_j]++; num_in_groups[root_i] -= num_in_groups[root_i];
} }
else { else {
pid[root_j] = root_i; pid[root_j] = root_i;
num_in_groups[root_j]--; num_in_groups[root_i] += num_in_groups[root_j];
num_in_groups[root_i]++; num_in_groups[root_j] -= num_in_groups[root_j];
} }
num_groups--; num_groups--;
...@@ -277,13 +277,13 @@ void fof_search_cell(struct space *s, struct cell *c, int *pid, int *num_in_grou ...@@ -277,13 +277,13 @@ void fof_search_cell(struct space *s, struct cell *c, int *pid, int *num_in_grou
if(root_j < root_i) { if(root_j < root_i) {
pid[root_i] = root_j; pid[root_i] = root_j;
num_in_groups[root_i]--; num_in_groups[root_j] += num_in_groups[root_i];
num_in_groups[root_j]++; num_in_groups[root_i] -= num_in_groups[root_i];
} }
else { else {
pid[root_j] = root_i; pid[root_j] = root_i;
num_in_groups[root_j]--; num_in_groups[root_i] += num_in_groups[root_j];
num_in_groups[root_i]++; num_in_groups[root_j] -= num_in_groups[root_j];
} }
(*num_groups)--; (*num_groups)--;
...@@ -310,10 +310,10 @@ void fof_search_pair_cells(struct space *s, struct cell *ci, struct cell *cj, in ...@@ -310,10 +310,10 @@ void fof_search_pair_cells(struct space *s, struct cell *ci, struct cell *cj, in
double diff[3]; double diff[3];
for (int k = 0; k < 3; k++) { for (int k = 0; k < 3; k++) {
diff[k] = cj->loc[k] - ci->loc[k]; diff[k] = cj->loc[k] - ci->loc[k];
if (periodic && diff[k] < -s->dim[k] / 2) if (periodic && diff[k] < -dim[k] / 2)
shift[k] = s->dim[k]; shift[k] = dim[k];
else if (periodic && diff[k] > s->dim[k] / 2) else if (periodic && diff[k] > dim[k] / 2)
shift[k] = -s->dim[k]; shift[k] = -dim[k];
else else
shift[k] = 0.0; shift[k] = 0.0;
diff[k] += shift[k]; diff[k] += shift[k];
...@@ -357,13 +357,13 @@ void fof_search_pair_cells(struct space *s, struct cell *ci, struct cell *cj, in ...@@ -357,13 +357,13 @@ void fof_search_pair_cells(struct space *s, struct cell *ci, struct cell *cj, in
if(root_j < root_i) { if(root_j < root_i) {
pid[root_i] = root_j; pid[root_i] = root_j;
num_in_groups[root_i]--; num_in_groups[root_j] += num_in_groups[root_i];
num_in_groups[root_j]++; num_in_groups[root_i] -= num_in_groups[root_i];
} }
else { else {
pid[root_j] = root_i; pid[root_j] = root_i;
num_in_groups[root_j]--; num_in_groups[root_i] += num_in_groups[root_j];
num_in_groups[root_i]++; num_in_groups[root_j] -= num_in_groups[root_j];
} }
(*num_groups)--; (*num_groups)--;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment