diff --git a/src/cache.h b/src/cache.h index f4032e166cd0551a08e95b40b0afda8f256c8a2f..2edd0c7958863e0a56e62ba270375b3eb455085f 100644 --- a/src/cache.h +++ b/src/cache.h @@ -208,7 +208,7 @@ __attribute__((always_inline)) INLINE int cache_read_particles( for (int i = 0; i < ci->hydro.count; i++) { /* Skip inhibited particles. */ - if(parts[i].time_bin == time_bin_inhibited) continue; + if (parts[i].time_bin == time_bin_inhibited) continue; x[uninhibited_count] = (float)(parts[i].x[0] - loc[0]); y[uninhibited_count] = (float)(parts[i].x[1] - loc[1]); @@ -401,7 +401,7 @@ __attribute__((always_inline)) INLINE int cache_read_force_particles( for (int i = 0; i < ci->hydro.count; i++) { /* Skip inhibited particles. */ - if(parts[i].time_bin == time_bin_inhibited) continue; + if (parts[i].time_bin == time_bin_inhibited) continue; x[uninhibited_count] = (float)(parts[i].x[0] - loc[0]); y[uninhibited_count] = (float)(parts[i].x[1] - loc[1]); @@ -499,9 +499,9 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted( * precision can be used instead of double precision. */ for (int i = 0; i < ci_cache_count; i++) { const int idx = sort_i[i + first_pi_align].i; - + /* Put inhibited particles out of range. */ - if(parts_i[idx].time_bin == time_bin_inhibited) { + if (parts_i[idx].time_bin == time_bin_inhibited) { x[i] = pos_padded[0]; y[i] = pos_padded[1]; z[i] = pos_padded[2]; @@ -514,7 +514,7 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted( continue; } - + x[i] = (float)(parts_i[idx].x[0] - total_ci_shift[0]); y[i] = (float)(parts_i[idx].x[1] - total_ci_shift[1]); z[i] = (float)(parts_i[idx].x[2] - total_ci_shift[2]); @@ -601,9 +601,9 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted( for (int i = 0; i <= last_pj_align; i++) { const int idx = sort_j[i].i; - + /* Put inhibited particles out of range. */ - if(parts_j[idx].time_bin == time_bin_inhibited) { + if (parts_j[idx].time_bin == time_bin_inhibited) { xj[i] = pos_padded_j[0]; yj[i] = pos_padded_j[1]; zj[i] = pos_padded_j[2]; @@ -760,9 +760,9 @@ cache_read_two_partial_cells_sorted_force( for (int i = 0; i < ci_cache_count; i++) { const int idx = sort_i[i + first_pi_align].i; - + /* Put inhibited particles out of range. */ - if(parts_i[idx].time_bin == time_bin_inhibited) { + if (parts_i[idx].time_bin == time_bin_inhibited) { x[i] = pos_padded[0]; y[i] = pos_padded[1]; z[i] = pos_padded[2]; @@ -846,7 +846,7 @@ cache_read_two_partial_cells_sorted_force( const int idx = sort_j[i].i; /* Put inhibited particles out of range. */ - if(parts_j[idx].time_bin == time_bin_inhibited) { + if (parts_j[idx].time_bin == time_bin_inhibited) { xj[i] = pos_padded_j[0]; yj[i] = pos_padded_j[1]; zj[i] = pos_padded_j[2]; @@ -884,7 +884,7 @@ cache_read_two_partial_cells_sorted_force( /* Pad cache with fake particles that exist outside the cell so will not * interact. We use values of the same magnitude (but negative!) as the real * particles to avoid overflow problems. */ - for (int i = last_pj_align + 1; i < last_pj_align + 1 + VEC_SIZE; i++) { + for (int i = last_pj_align + 1; i < last_pj_align + 1 + VEC_SIZE; i++) { xj[i] = pos_padded_j[0]; yj[i] = pos_padded_j[1]; zj[i] = pos_padded_j[2]; diff --git a/src/runner_doiact.h b/src/runner_doiact.h index d3364b0b5a122b6a7b894871e3bf22c4c79d627b..5d056a993ef27e9783c9a0253aef0136e46b28f4 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -168,10 +168,10 @@ 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]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + const int pi_active = part_is_active(pi, e); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; @@ -184,9 +184,9 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci, /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts_j[pjd]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; + if (part_is_inhibited(pj, e)) continue; const float hj = pj->h; const float hjg2 = hj * hj * kernel_gamma2; @@ -276,10 +276,10 @@ 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]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + const int pi_active = part_is_active(pi, e); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; @@ -292,10 +292,10 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci, /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts_j[pjd]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const int pj_active = part_is_active(pj, e); const float hj = pj->h; const float hjg2 = hj * hj * kernel_gamma2; @@ -378,10 +378,10 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) { /* Get a hold of the ith part in ci. */ struct part *restrict pi = &parts[pid]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + const int pi_active = part_is_active(pi, e); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; @@ -394,10 +394,10 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) { /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts[pjd]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; const float hjg2 = hj * hj * kernel_gamma2; const int pj_active = part_is_active(pj, e); @@ -480,10 +480,10 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) { /* Get a hold of the ith part in ci. */ struct part *restrict pi = &parts[pid]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + const int pi_active = part_is_active(pi, e); const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; @@ -496,10 +496,10 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) { /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts[pjd]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; const float hjg2 = hj * hj * kernel_gamma2; const int pj_active = part_is_active(pj, e); @@ -511,10 +511,8 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) { float dx[3] = {pix[0] - pjx[0], pix[1] - pjx[1], pix[2] - pjx[2]}; const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; - const int doi = - pi_active && ((r2 < hig2) || (r2 < hjg2)); - const int doj = - pj_active && ((r2 < hig2) || (r2 < hjg2)); + const int doi = pi_active && ((r2 < hig2) || (r2 < hjg2)); + const int doj = pj_active && ((r2 < hig2) || (r2 < hjg2)); #ifdef SWIFT_DEBUG_CHECKS /* Check that particles have been drifted to the current time */ @@ -693,10 +691,10 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci, /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts_j[sort_j[pjd].i]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; const double pjx = pj->x[0]; const double pjy = pj->x[1]; @@ -748,10 +746,10 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci, /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts_j[sort_j[pjd].i]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; const double pjx = pj->x[0]; const double pjy = pj->x[1]; @@ -888,10 +886,10 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci, /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts_j[pjd]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; /* Compute the pairwise distance. */ @@ -1025,10 +1023,10 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Recover pj */ struct part *pj = &parts_j[sort_j[pjd].i]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; const float pjx = pj->x[0] - cj->loc[0]; const float pjy = pj->x[1] - cj->loc[1]; @@ -1112,9 +1110,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]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; + if (part_is_inhibited(pi, e)) continue; const float hi = pi->h; const float pix = pi->x[0] - (cj->loc[0] + shift[0]); @@ -1374,10 +1372,10 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Get a hold of the ith part in ci. */ struct part *pi = &parts_i[sort_i[pid].i]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + const float hi = pi->h; /* Is there anything we need to interact with (for this specific hi) ? */ @@ -1463,10 +1461,10 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Recover pj */ struct part *pj = &parts_j[sort_j[pjd].i]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; /* Get the position of pj in the right frame */ @@ -1541,10 +1539,10 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Get a hold of the jth part in cj. */ struct part *pj = &parts_j[sort_j[pjd].i]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; /* Is there anything we need to interact with (for this specific hj) ? */ @@ -1632,10 +1630,10 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid, /* Recover pi */ struct part *pi = &parts_i[sort_i[pid].i]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; @@ -1841,7 +1839,7 @@ void DOSELF1(struct runner *r, struct cell *restrict c) { struct part *restrict pi = &parts[pid]; /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; + if (part_is_inhibited(pi, e)) continue; /* Get the particle position and radius. */ double pix[3]; @@ -1897,10 +1895,10 @@ void DOSELF1(struct runner *r, struct cell *restrict c) { /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts[pjd]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; /* Compute the pairwise distance. */ @@ -2028,10 +2026,10 @@ void DOSELF2(struct runner *r, struct cell *restrict c) { /* Get a pointer to the ith particle. */ struct part *restrict pi = &parts[pid]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + /* Get the particle position and radius. */ double pix[3]; for (int k = 0; k < 3; k++) pix[k] = pi->x[k]; @@ -2086,10 +2084,10 @@ void DOSELF2(struct runner *r, struct cell *restrict c) { /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts[pjd]; - + /* Skip inhibited particles. */ - if(part_is_inhibited(pj, e)) continue; - + if (part_is_inhibited(pj, e)) continue; + const float hj = pj->h; /* Compute the pairwise distance. */ diff --git a/src/runner_doiact_vec.c b/src/runner_doiact_vec.c index 5369c40dcf89241d4ddf81aa541d3a4ef8179cb8..4ea22925b316ccc1abb6fb2efe794e04f096c488 100644 --- a/src/runner_doiact_vec.c +++ b/src/runner_doiact_vec.c @@ -688,8 +688,8 @@ void runner_doself1_density_vec(struct runner *r, struct cell *restrict c) { struct part *restrict pi = &parts[pid]; /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + /* Is the ith particle active? */ if (!part_is_active_no_debug(pi, max_active_bin)) continue; @@ -1151,8 +1151,8 @@ void runner_doself2_force_vec(struct runner *r, struct cell *restrict c) { struct part *restrict pi = &parts[pid]; /* Skip inhibited particles. */ - if(part_is_inhibited(pi, e)) continue; - + if (part_is_inhibited(pi, e)) continue; + /* Is the ith particle active? */ if (!part_is_active_no_debug(pi, max_active_bin)) continue; @@ -1344,10 +1344,12 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci, #ifdef SWIFT_DEBUG_CHECKS /* Check that particles have been drifted to the current time */ for (int pid = 0; pid < count_i; pid++) - if (parts_i[pid].ti_drift != e->ti_current && !part_is_inhibited(&parts_i[pid], e)) + if (parts_i[pid].ti_drift != e->ti_current && + !part_is_inhibited(&parts_i[pid], e)) error("Particle pi not drifted to current time"); for (int pjd = 0; pjd < count_j; pjd++) - if (parts_j[pjd].ti_drift != e->ti_current && !part_is_inhibited(&parts_j[pjd], e)) + if (parts_j[pjd].ti_drift != e->ti_current && + !part_is_inhibited(&parts_j[pjd], e)) error("Particle pj not drifted to current time"); #endif @@ -2035,10 +2037,12 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci, #ifdef SWIFT_DEBUG_CHECKS /* Check that particles have been drifted to the current time */ for (int pid = 0; pid < count_i; pid++) - if (parts_i[pid].ti_drift != e->ti_current && !part_is_inhibited(&parts_i[pid], e)) + if (parts_i[pid].ti_drift != e->ti_current && + !part_is_inhibited(&parts_i[pid], e)) error("Particle pi not drifted to current time"); for (int pjd = 0; pjd < count_j; pjd++) - if (parts_j[pjd].ti_drift != e->ti_current && !part_is_inhibited(&parts_j[pjd], e)) + if (parts_j[pjd].ti_drift != e->ti_current && + !part_is_inhibited(&parts_j[pjd], e)) error("Particle pj not drifted to current time"); #endif