Commit bc81da44 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Do not pass the globabl chemistry_data to the interaction function. Creates...

Do not pass the globabl chemistry_data to the interaction function. Creates problems and is not required by any of the schemes yet.
parent 996ecde4
......@@ -36,11 +36,10 @@
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param chem_data Chemistry informations
*/
__attribute__((always_inline)) INLINE static void runner_iact_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj,
const struct chemistry_data *chem_data) {}
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) {
}
/**
* @brief Do chemistry computation after the runner_iact_density (non-symmetric
......@@ -52,10 +51,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_chemistry(
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param chem_data Chemistry informations
*/
__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, const struct chemistry_data *chem_data) {}
const struct part *pj) {}
#endif /* SWIFT_EAGLE_CHEMISTRY_IACT_H */
......@@ -41,11 +41,9 @@
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param chem_data Chemistry informations
*/
__attribute__((always_inline)) INLINE static void runner_iact_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj,
const struct chemistry_data *chem_data) {
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) {
struct chemistry_part_data *chi = &pi->chemistry_data;
struct chemistry_part_data *chj = &pj->chemistry_data;
......@@ -87,11 +85,10 @@ __attribute__((always_inline)) INLINE static void runner_iact_chemistry(
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param chem_data Chemistry informations
*/
__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, const struct chemistry_data *chem_data) {
const struct part *pj) {
struct chemistry_part_data *chi = &pi->chemistry_data;
const struct chemistry_part_data *chj = &pj->chemistry_data;
......
......@@ -39,11 +39,10 @@
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param chem_data Chemistry informations
*/
__attribute__((always_inline)) INLINE static void runner_iact_chemistry(
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj,
const struct chemistry_data *chem_data) {}
float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) {
}
/**
* @brief do chemistry computation after the runner_iact_density (non symmetric
......@@ -55,10 +54,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_chemistry(
* @param hj Smoothing length of j
* @param pi #part i
* @param pj #part j
* @param chem_data Chemistry informations
*/
__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, const struct chemistry_data *chem_data) {}
const struct part *pj) {}
#endif /* SWIFT_NONE_CHEMISTRY_IACT_H */
......@@ -198,7 +198,7 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
}
if (r2 < hjg2 && pj_active) {
......@@ -209,7 +209,7 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
......@@ -294,13 +294,13 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
IACT(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else if (pi_active) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else if (pj_active) {
......@@ -310,7 +310,7 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
}
......@@ -382,13 +382,13 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) {
IACT(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else if (doi) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else if (doj) {
......@@ -398,7 +398,7 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
} /* loop over the parts in cj. */
......@@ -469,13 +469,13 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) {
IACT(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else if (doi) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else if (doj) {
......@@ -485,7 +485,7 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
} /* loop over the parts in cj. */
......@@ -561,8 +561,7 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hi, pj->h, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, pj->h, pi, pj,
r->e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, pj->h, pi, pj);
#endif
}
} /* loop over the parts in cj. */
......@@ -643,7 +642,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, r->e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
}
} /* loop over the parts in cj. */
......@@ -694,7 +693,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, r->e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
}
} /* loop over the parts in cj. */
......@@ -823,8 +822,7 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
IACT_NONSYM(r2, dx, hi, pj->h, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, pj->h, pi, pj,
r->e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, pj->h, pi, pj);
#endif
}
} /* loop over the parts in cj. */
......@@ -975,7 +973,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
}
} /* loop over the parts in cj. */
......@@ -1058,7 +1056,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
} /* loop over the parts in ci. */
......@@ -1324,7 +1322,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);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
} /* loop over the active parts in cj. */
......@@ -1389,12 +1387,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);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else {
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
}
}
......@@ -1484,7 +1482,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);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
}
} /* loop over the active parts in ci. */
......@@ -1552,12 +1550,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);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_chemistry(r2, dx, hj, hi, pj, pi);
#endif
} else {
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
}
......@@ -1726,7 +1724,7 @@ void DOSELF1(struct runner *r, struct cell *restrict c) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
} /* loop over all other particles. */
......@@ -1770,12 +1768,12 @@ void DOSELF1(struct runner *r, struct cell *restrict c) {
if (r2 < hig2 && doj) {
IACT(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else if (!doj) {
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else {
dx[0] = -dx[0];
......@@ -1783,7 +1781,7 @@ void DOSELF1(struct runner *r, struct cell *restrict c) {
dx[2] = -dx[2];
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
}
......@@ -1898,7 +1896,7 @@ void DOSELF2(struct runner *r, struct cell *restrict c) {
IACT_NONSYM(r2, dx, hj, hi, pj, pi);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hj, hi, pj, pi);
#endif
}
} /* loop over all other particles. */
......@@ -1940,12 +1938,12 @@ void DOSELF2(struct runner *r, struct cell *restrict c) {
if (part_is_active(pj, e)) {
IACT(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_chemistry(r2, dx, hi, hj, pi, pj);
#endif
} else {
IACT_NONSYM(r2, dx, hi, hj, pi, pj);
#if (FUNCTION_TASK_LOOP == TASK_LOOP_DENSITY)
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj, e->chemistry);
runner_iact_nonsym_chemistry(r2, dx, hi, hj, pi, pj);
#endif
}
}
......
......@@ -47,15 +47,6 @@ int main(int argc, char *argv[]) {
*(((float *)&pj) + i) = (float)random_uniform(0., 2.);
}
/* Create a chemistry structure */
struct chemistry_data chemistry;
/* At one point, we will need to initialize the chemistry
chemistry_init(const struct swift_params* parameter_file,
const struct unit_system* us,
const struct phys_const* phys_const,
&chemistry);
*/
/* Make the particle smoothing length and position reasonable */
for (size_t i = 0; i < 3; ++i) pi.x[0] = random_uniform(-1., 1.);
for (size_t i = 0; i < 3; ++i) pj.x[0] = random_uniform(-1., 1.);
......@@ -147,18 +138,18 @@ int main(int argc, char *argv[]) {
/* Call the symmetric version */
runner_iact_density(r2, dx, pi.h, pj.h, &pi, &pj);
/* Now the chemistry. WARNING chemistry is not initialized */
runner_iact_chemistry(r2, dx, pi.h, pj.h, &pi, &pj, &chemistry);
runner_iact_chemistry(r2, dx, pi.h, pj.h, &pi, &pj);
/* Call the non-symmetric version */
runner_iact_nonsym_density(r2, dx, pi2.h, pj2.h, &pi2, &pj2);
/* Now the chemistry. WARNING chemistry is not initialized */
runner_iact_nonsym_chemistry(r2, dx, pi2.h, pj2.h, &pi2, &pj2, &chemistry);
runner_iact_nonsym_chemistry(r2, dx, pi2.h, pj2.h, &pi2, &pj2);
dx[0] = -dx[0];
dx[1] = -dx[1];
dx[2] = -dx[2];
runner_iact_nonsym_density(r2, dx, pj2.h, pi2.h, &pj2, &pi2);
/* Now the chemistry. WARNING chemistry is not initialized */
runner_iact_nonsym_chemistry(r2, dx, pj2.h, pi2.h, &pj2, &pi2, &chemistry);
runner_iact_nonsym_chemistry(r2, dx, pj2.h, pi2.h, &pj2, &pi2);
/* Check that the particles are the same */
i_ok = memcmp(&pi, &pi2, sizeof(struct part));
......
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