Commit 78eeaf95 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Pass the cosmological parameters to the chemistry interaction functions.

parent cdf92cc4
......@@ -24,36 +24,38 @@
* @brief Smooth metal interaction functions following the EAGLE model.
*/
#include "chemistry_struct.h"
/**
* @brief Do chemistry computation after the runner_iact_density (symmetric
* @brief do chemistry computation after the runner_iact_density (symmetric
* version)
*
* @param r2 Distance squared between particles
* @param dx Distance between particles
* @param hi Smoothing length of i
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle.
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) {
}
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
struct part *restrict pj, float a, float H) {}
/**
* @brief Do chemistry computation after the runner_iact_density (non-symmetric
* @brief do chemistry computation after the runner_iact_density (non symmetric
* version)
*
* @param r2 Distance squared between particles
* @param dx Distance between particles
* @param hi Smoothing length of i
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle (not updated).
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_nonsym_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi,
const struct part *pj) {}
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
const struct part *restrict pj, float a, float H) {}
#endif /* SWIFT_EAGLE_CHEMISTRY_IACT_H */
......@@ -29,21 +29,22 @@
* al. 2009
*/
#include "chemistry_struct.h"
/**
* @brief do chemistry computation after the runner_iact_density (symmetric
* version)
*
* @param r2 Distance squared between particles
* @param dx Distance between particles
* @param hi Smoothing length of i
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle.
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) {
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
struct part *restrict pj, float a, float H) {
struct chemistry_part_data *chi = &pi->chemistry_data;
struct chemistry_part_data *chj = &pj->chemistry_data;
......@@ -79,16 +80,18 @@ __attribute__((always_inline)) INLINE static void runner_iact_chemistry(
* @brief do chemistry computation after the runner_iact_density (non symmetric
* version)
*
* @param r2 Distance squared between particles
* @param dx Distance between particles
* @param hi Smoothing length of i
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle (not updated).
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_nonsym_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi,
const struct part *pj) {
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
const struct part *restrict pj, float a, float H) {
struct chemistry_part_data *chi = &pi->chemistry_data;
const struct chemistry_part_data *chj = &pj->chemistry_data;
......
......@@ -25,38 +25,38 @@
* @brief Density computation
*/
#include "cache.h"
#include "chemistry_struct.h"
#include "minmax.h"
/**
* @brief do chemistry computation after the runner_iact_density (symmetric
* version)
*
* @param r2 Distance squared between particles
* @param dx Distance between particles
* @param hi Smoothing length of i
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle.
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) {
}
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
struct part *restrict pj, float a, float H) {}
/**
* @brief do chemistry computation after the runner_iact_density (non symmetric
* version)
*
* @param r2 Distance squared between particles
* @param dx Distance between particles
* @param hi Smoothing length of i
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
* @param hj Comoving smoothing-length of particle j.
* @param pi First particle.
* @param pj Second particle (not updated).
* @param a Current scale factor.
* @param H Current Hubble parameter.
*/
__attribute__((always_inline)) INLINE static void runner_iact_nonsym_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi,
const struct part *pj) {}
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
const struct part *restrict pj, float a, float H) {}
#endif /* SWIFT_NONE_CHEMISTRY_IACT_H */
......@@ -204,7 +204,7 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
}
if (r2 < hjg2 && pj_active) {
......@@ -215,7 +215,7 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
......@@ -306,13 +306,13 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
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);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (pi_active) {
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (pj_active) {
......@@ -322,7 +322,7 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
}
......@@ -401,13 +401,13 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) {
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);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (doi) {
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (doj) {
......@@ -417,7 +417,7 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
} /* loop over the parts in cj. */
......@@ -495,13 +495,13 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) {
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);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (doi) {
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (doj) {
......@@ -511,7 +511,7 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
} /* loop over the parts in cj. */
......@@ -593,7 +593,7 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hi, pj->h, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, pj->h, pi, pj);
runner_iact_nonsym_chemistry(r2, dx, hi, pj->h, pi, pj, a, H);
#endif
}
} /* loop over the parts in cj. */
......@@ -681,7 +681,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
}
} /* loop over the parts in cj. */
......@@ -732,7 +732,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
}
} /* loop over the parts in cj. */
......@@ -845,6 +845,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 float hj = pj->h;
/* Compute the pairwise distance. */
const float pjx[3] = {(float)(pj->x[0] - ci->loc[0]),
......@@ -864,9 +865,9 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
/* Hit or miss? */
if (r2 > 0.f && r2 < hig2) {
IACT_NONSYM(r2, dx, hi, pj->h, pi, pj, a, H);
IACT_NONSYM(r2, dx, hi, hj, pi, pj, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, pj->h, pi, pj);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
}
} /* loop over the parts in cj. */
......@@ -1022,7 +1023,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
}
} /* loop over the parts in cj. */
......@@ -1105,7 +1106,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
} /* loop over the parts in ci. */
......@@ -1376,7 +1377,7 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
if (r2 < hig2) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
} /* loop over the active parts in cj. */
......@@ -1441,12 +1442,12 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
if (part_is_active(pj, e)) {
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);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else {
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
}
}
......@@ -1536,7 +1537,7 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
if (r2 < hjg2 && r2 >= hig2) {
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
}
} /* loop over the active parts in ci. */
......@@ -1604,12 +1605,12 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
if (part_is_active(pi, e)) {
IACT(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
} else {
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
}
......@@ -1783,7 +1784,7 @@ void DOSELF1(struct runner *r, struct cell *restrict c) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
} /* loop over all other particles. */
......@@ -1827,12 +1828,12 @@ void DOSELF1(struct runner *r, struct cell *restrict c) {
if (r2 < hig2 && doj) {
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);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else if (!doj) {
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else {
dx[0] = -dx[0];
......@@ -1840,7 +1841,7 @@ void DOSELF1(struct runner *r, struct cell *restrict c) {
dx[2] = -dx[2];
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
}
......@@ -1960,7 +1961,7 @@ void DOSELF2(struct runner *r, struct cell *restrict c) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, a, H);
#endif
}
} /* loop over all other particles. */
......@@ -2002,12 +2003,12 @@ void DOSELF2(struct runner *r, struct cell *restrict c) {
if (part_is_active(pj, e)) {
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);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#endif
} else {
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);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, a, H);
#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