Commit 95cb0e07 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Correctly skip inactive particles in the P-P pair tasks.

parent b2b4a66f
......@@ -200,6 +200,9 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
/* Loop over all particles in ci... */
for (int pid = 0; pid < gcount_i; pid++) {
/* Skip inactive particles */
if (!gpart_is_active(&gparts_i[pid], e)) continue;
const float x_i = ci_cache->x[pid];
const float y_i = ci_cache->y[pid];
const float z_i = ci_cache->z[pid];
......@@ -272,7 +275,8 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
a_z -= f_ij * dz;
#ifdef SWIFT_DEBUG_CHECKS
gparts_i[pid].num_interacted++;
/* Update the interaction counter if it's not a padded gpart */
if (pjd < gcount_j) gparts_i[pid].num_interacted++;
#endif
}
......@@ -289,6 +293,9 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
/* Loop over all particles in ci... */
for (int pjd = 0; pjd < gcount_j; pjd++) {
/* Skip inactive particles */
if (!gpart_is_active(&gparts_j[pjd], e)) continue;
const float x_j = cj_cache->x[pjd];
const float y_j = cj_cache->y[pjd];
const float z_j = cj_cache->z[pjd];
......@@ -361,7 +368,8 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
a_z -= f_ji * dz;
#ifdef SWIFT_DEBUG_CHECKS
gparts_j[pjd].num_interacted++;
/* Update the interaction counter if it's not a padded gpart */
if (pid < gcount_i) gparts_j[pjd].num_interacted++;
#endif
}
......@@ -535,6 +543,9 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Loop over all particles in ci... */
for (int pid = 0; pid < gcount_i; pid++) {
/* Skip inactive particles */
if (!gpart_is_active(&gparts_i[pid], e)) continue;
const float x_i = ci_cache->x[pid];
const float y_i = ci_cache->y[pid];
const float z_i = ci_cache->z[pid];
......@@ -612,7 +623,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
a_z -= f_ij * dz;
#ifdef SWIFT_DEBUG_CHECKS
gparts_i[pid].num_interacted++;
/* Update the interaction counter if it's not a padded gpart */
if (pjd < gcount_j) gparts_i[pid].num_interacted++;
#endif
}
......@@ -629,6 +641,9 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Loop over all particles in ci... */
for (int pjd = 0; pjd < gcount_j; pjd++) {
/* Skip inactive particles */
if (!gpart_is_active(&gparts_j[pjd], e)) continue;
const float x_j = cj_cache->x[pjd];
const float y_j = cj_cache->y[pjd];
const float z_j = cj_cache->z[pjd];
......@@ -706,7 +721,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
a_z -= f_ji * dz;
#ifdef SWIFT_DEBUG_CHECKS
gparts_j[pjd].num_interacted++;
/* Update the interaction counter if it's not a padded gpart */
if (pid < gcount_i) gparts_j[pjd].num_interacted++;
#endif
}
......
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