Skip to content
Snippets Groups Projects
Commit 95cb0e07 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

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

parent b2b4a66f
Branches darwin/gear_preSN_feedback
No related tags found
1 merge request!398Use particle caches for the gravity P-P interactions. Ewald summation for the gravity force checks
...@@ -200,6 +200,9 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci, ...@@ -200,6 +200,9 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
/* Loop over all particles in ci... */ /* Loop over all particles in ci... */
for (int pid = 0; pid < gcount_i; pid++) { 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 x_i = ci_cache->x[pid];
const float y_i = ci_cache->y[pid]; const float y_i = ci_cache->y[pid];
const float z_i = ci_cache->z[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, ...@@ -272,7 +275,8 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
a_z -= f_ij * dz; a_z -= f_ij * dz;
#ifdef SWIFT_DEBUG_CHECKS #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 #endif
} }
...@@ -289,6 +293,9 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci, ...@@ -289,6 +293,9 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
/* Loop over all particles in ci... */ /* Loop over all particles in ci... */
for (int pjd = 0; pjd < gcount_j; pjd++) { 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 x_j = cj_cache->x[pjd];
const float y_j = cj_cache->y[pjd]; const float y_j = cj_cache->y[pjd];
const float z_j = cj_cache->z[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, ...@@ -361,7 +368,8 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
a_z -= f_ji * dz; a_z -= f_ji * dz;
#ifdef SWIFT_DEBUG_CHECKS #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 #endif
} }
...@@ -535,6 +543,9 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -535,6 +543,9 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Loop over all particles in ci... */ /* Loop over all particles in ci... */
for (int pid = 0; pid < gcount_i; pid++) { 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 x_i = ci_cache->x[pid];
const float y_i = ci_cache->y[pid]; const float y_i = ci_cache->y[pid];
const float z_i = ci_cache->z[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, ...@@ -612,7 +623,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
a_z -= f_ij * dz; a_z -= f_ij * dz;
#ifdef SWIFT_DEBUG_CHECKS #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 #endif
} }
...@@ -629,6 +641,9 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -629,6 +641,9 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Loop over all particles in ci... */ /* Loop over all particles in ci... */
for (int pjd = 0; pjd < gcount_j; pjd++) { 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 x_j = cj_cache->x[pjd];
const float y_j = cj_cache->y[pjd]; const float y_j = cj_cache->y[pjd];
const float z_j = cj_cache->z[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, ...@@ -706,7 +721,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
a_z -= f_ji * dz; a_z -= f_ji * dz;
#ifdef SWIFT_DEBUG_CHECKS #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 #endif
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment