Commit 5d952c77 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Made the naive and subset hydro functions ignore inhibited particles. Regular self and pair next.

parent 425179f1
......@@ -169,6 +169,7 @@ 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];
const int pi_active = part_is_active(pi, e);
const int pi_inhibited = part_is_inhibited(pi, e);
const float hi = pi->h;
const float hig2 = hi * hi * kernel_gamma2;
const float pix[3] = {(float)(pi->x[0] - (cj->loc[0] + shift[0])),
......@@ -183,6 +184,7 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
const float hj = pj->h;
const float hjg2 = hj * hj * kernel_gamma2;
const int pj_active = part_is_active(pj, e);
const int pj_inhibited = part_is_inhibited(pj, e);
/* Compute the pairwise distance. */
const float pjx[3] = {(float)(pj->x[0] - cj->loc[0]),
......@@ -193,21 +195,21 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
#ifdef SWIFT_DEBUG_CHECKS
/* Check that particles have been drifted to the current time */
if (pi->ti_drift != e->ti_current)
if (pi->ti_drift != e->ti_current && !pi_inhibited)
error("Particle pi not drifted to current time");
if (pj->ti_drift != e->ti_current)
if (pj->ti_drift != e->ti_current && !pj_inhibited)
error("Particle pj not drifted to current time");
#endif
/* Hit or miss? */
if (r2 < hig2 && pi_active) {
if (r2 < hig2 && pi_active && !pj_inhibited) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
}
if (r2 < hjg2 && pj_active) {
if (r2 < hjg2 && pj_active && !pi_inhibited) {
dx[0] = -dx[0];
dx[1] = -dx[1];
......@@ -269,6 +271,7 @@ 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];
const int pi_active = part_is_active(pi, e);
const int pi_inhibited = part_is_inhibited(pi, e);
const float hi = pi->h;
const float hig2 = hi * hi * kernel_gamma2;
const float pix[3] = {(float)(pi->x[0] - (cj->loc[0] + shift[0])),
......@@ -281,6 +284,7 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
/* Get a pointer to the jth particle. */
struct part *restrict pj = &parts_j[pjd];
const int pj_active = part_is_active(pj, e);
const int pj_inhibited = part_is_inhibited(pj, e);
const float hj = pj->h;
const float hjg2 = hj * hj * kernel_gamma2;
......@@ -293,28 +297,28 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
#ifdef SWIFT_DEBUG_CHECKS
/* Check that particles have been drifted to the current time */
if (pi->ti_drift != e->ti_current)
if (pi->ti_drift != e->ti_current && !pj_inhibited)
error("Particle pi not drifted to current time");
if (pj->ti_drift != e->ti_current)
if (pj->ti_drift != e->ti_current && !pi_inhibited)
error("Particle pj not drifted to current time");
#endif
/* Hit or miss? */
if (r2 < hig2 || r2 < hjg2) {
if (pi_active && pj_active) {
if (pi_active && pj_active && !pi_inhibited && !pj_inhibited) {
IACT(r2, dx, hi, hj, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (pi_active) {
} else if (pi_active && !pj_inhibited) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (pj_active) {
} else if (pj_active && !pi_inhibited) {
dx[0] = -dx[0];
dx[1] = -dx[1];
......@@ -363,6 +367,7 @@ 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];
const int pi_active = part_is_active(pi, e);
const int pi_inhibited = part_is_inhibited(pi, e);
const float hi = pi->h;
const float hig2 = hi * hi * kernel_gamma2;
const float pix[3] = {(float)(pi->x[0] - c->loc[0]),
......@@ -377,6 +382,7 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) {
const float hj = pj->h;
const float hjg2 = hj * hj * kernel_gamma2;
const int pj_active = part_is_active(pj, e);
const int pj_inhibited = part_is_inhibited(pj, e);
/* Compute the pairwise distance. */
const float pjx[3] = {(float)(pj->x[0] - c->loc[0]),
......@@ -385,14 +391,14 @@ void DOSELF1_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);
const int doj = pj_active && (r2 < hjg2);
const int doi = pi_active && (r2 < hig2) && !pj_inhibited;
const int doj = pj_active && (r2 < hjg2) && !pi_inhibited;
#ifdef SWIFT_DEBUG_CHECKS
/* Check that particles have been drifted to the current time */
if (pi->ti_drift != e->ti_current)
if (pi->ti_drift != e->ti_current && !pi_inhibited)
error("Particle pi not drifted to current time");
if (pj->ti_drift != e->ti_current)
if (pj->ti_drift != e->ti_current && !pj_inhibited)
error("Particle pj not drifted to current time");
#endif
......@@ -457,6 +463,7 @@ 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];
const int pi_active = part_is_active(pi, e);
const int pi_inhibited = part_is_inhibited(pi, e);
const float hi = pi->h;
const float hig2 = hi * hi * kernel_gamma2;
const float pix[3] = {(float)(pi->x[0] - c->loc[0]),
......@@ -471,6 +478,7 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) {
const float hj = pj->h;
const float hjg2 = hj * hj * kernel_gamma2;
const int pj_active = part_is_active(pj, e);
const int pj_inhibited = part_is_inhibited(pj, e);
/* Compute the pairwise distance. */
const float pjx[3] = {(float)(pj->x[0] - c->loc[0]),
......@@ -479,14 +487,16 @@ 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)) && !pj_inhibited;
const int doj =
pj_active && ((r2 < hig2) || (r2 < hjg2)) && !pi_inhibited;
#ifdef SWIFT_DEBUG_CHECKS
/* Check that particles have been drifted to the current time */
if (pi->ti_drift != e->ti_current)
if (pi->ti_drift != e->ti_current && !pi_inhibited)
error("Particle pi not drifted to current time");
if (pj->ti_drift != e->ti_current)
if (pj->ti_drift != e->ti_current && !pj_inhibited)
error("Particle pj not drifted to current time");
#endif
......@@ -571,6 +581,7 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
/* Get a pointer to the jth particle. */
struct part *restrict pj = &parts_j[pjd];
const int pj_inhibited = part_is_inhibited(pj, e);
/* Compute the pairwise distance. */
float r2 = 0.0f;
......@@ -584,12 +595,12 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
/* Check that particles have been drifted to the current time */
if (pi->ti_drift != e->ti_current)
error("Particle pi not drifted to current time");
if (pj->ti_drift != e->ti_current)
if (pj->ti_drift != e->ti_current && !pj_inhibited)
error("Particle pj not drifted to current time");
#endif
/* Hit or miss? */
if (r2 < hig2) {
if (r2 < hig2 && !pj_inhibited) {
IACT_NONSYM(r2, dx, hi, pj->h, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
......@@ -658,6 +669,7 @@ 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];
const int pj_inhibited = part_is_inhibited(pj, e);
const float hj = pj->h;
const double pjx = pj->x[0];
const double pjy = pj->x[1];
......@@ -672,12 +684,12 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
/* Check that particles have been drifted to the current time */
if (pi->ti_drift != e->ti_current)
error("Particle pi not drifted to current time");
if (pj->ti_drift != e->ti_current)
if (pj->ti_drift != e->ti_current && !pj_inhibited)
error("Particle pj not drifted to current time");
#endif
/* Hit or miss? */
if (r2 < hig2) {
if (r2 < hig2 && !pj_inhibited) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
......@@ -709,6 +721,7 @@ 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];
const int pj_inhibited = part_is_inhibited(pj, e);
const float hj = pj->h;
const double pjx = pj->x[0];
const double pjy = pj->x[1];
......@@ -723,12 +736,12 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
/* Check that particles have been drifted to the current time */
if (pi->ti_drift != e->ti_current)
error("Particle pi not drifted to current time");
if (pj->ti_drift != e->ti_current)
if (pj->ti_drift != e->ti_current && !pj_inhibited)
error("Particle pj not drifted to current time");
#endif
/* Hit or miss? */
if (r2 < hig2) {
if (r2 < hig2 && pj_inhibited) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
......@@ -845,6 +858,7 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
/* Get a pointer to the jth particle. */
struct part *restrict pj = &parts_j[pjd];
const int pj_inhibited = part_is_inhibited(pj, e);
const float hj = pj->h;
/* Compute the pairwise distance. */
......@@ -858,12 +872,12 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
/* Check that particles have been drifted to the current time */
if (pi->ti_drift != e->ti_current)
error("Particle pi not drifted to current time");
if (pj->ti_drift != e->ti_current)
if (pj->ti_drift != e->ti_current && !pj_inhibited)
error("Particle pj not drifted to current time");
#endif
/* Hit or miss? */
if (r2 > 0.f && r2 < hig2) {
if (r2 > 0.f && r2 < hig2 && !pj_inhibited) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
......
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