Skip to content
Snippets Groups Projects
Commit 1b482dcc authored by James Willis's avatar James Willis
Browse files

Created a function that branches calls to DOPAIR1 so that correct version is...

Created a function that branches calls to DOPAIR1 so that correct version is called. This decision is based upon whether MPI is running, vectorisation and orientation of the neighbouring cells.
parent b8702709
No related branches found
No related tags found
1 merge request!320Dopair1 vectorisation merge
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#define PASTE(x, y) x##_##y #define PASTE(x, y) x##_##y
#define _DOPAIR1_BRANCH(f) PASTE(runner_dopair1_branch, f)
#define DOPAIR1_BRANCH _DOPAIR1_BRANCH(FUNCTION)
#define _DOPAIR1(f) PASTE(runner_dopair1, f) #define _DOPAIR1(f) PASTE(runner_dopair1, f)
#define DOPAIR1 _DOPAIR1(FUNCTION) #define DOPAIR1 _DOPAIR1(FUNCTION)
...@@ -3017,3 +3020,47 @@ void DOSUB_SUBSET(struct runner *r, struct cell *ci, struct part *parts, ...@@ -3017,3 +3020,47 @@ void DOSUB_SUBSET(struct runner *r, struct cell *ci, struct part *parts,
if (gettimer) TIMER_TOC(TIMER_DOSUB_PAIR); if (gettimer) TIMER_TOC(TIMER_DOSUB_PAIR);
} }
/**
* @brief Determine which version of DOPAIR1 needs to be called depending on MPI, vectorisation and orientation of the cells or whether DOPAIR1 needs to be called at all.
*
* @param r #runner
* @param ci #cell ci
* @param cj #cell cj
*
*/
void DOPAIR1_BRANCH(struct runner *r, struct cell *ci, struct cell *cj) {
const struct engine *restrict e = r->e;
#ifdef WITH_MPI
if (ci->nodeID != cj->nodeID) {
DOPAIR1_NOSORT(r, ci, cj);
return;
}
#endif
/* Anything to do here? */
if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return;
/* Drift cells that are not drifted. */
if (!cell_is_drifted(ci, e)) cell_drift_particles(ci, e);
if (!cell_is_drifted(cj, e)) cell_drift_particles(cj, e);
/* Get the sort ID. */
double shift[3] = {0.0, 0.0, 0.0};
const int sid = space_getsid(e->s, &ci, &cj, shift);
/* Have the cells been sorted? */
if (!(ci->sorted & (1 << sid)) || !(cj->sorted & (1 << sid)))
error("Trying to interact unsorted cells.");
#if defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && (DOPAIR1_BRANCH == runner_dopair1_density_branch)
if(!space_iscorner(sid))
runner_dopair1_density_vec(r, ci, cj);
else
DOPAIR1(r, ci, cj);
#else
DOPAIR1(r, ci, cj);
#endif
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment