Skip to content
Snippets Groups Projects
Commit 9ff81d71 authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Add ids of interacting spart

parent 0fb513e0
No related branches found
No related tags found
3 merge requests!745Rewrite of MPI loops - Add stellar feedback loops,!744Mpi stars2 matthieu,!700Stars smoothing length over MPI
...@@ -56,6 +56,7 @@ __attribute__((always_inline)) INLINE static void stars_init_spart( ...@@ -56,6 +56,7 @@ __attribute__((always_inline)) INLINE static void stars_init_spart(
struct spart* sp) { struct spart* sp) {
#ifdef DEBUG_INTERACTIONS_STARS #ifdef DEBUG_INTERACTIONS_STARS
for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS_STARS; ++i) sp->ids_ngbs_density[i] = -1;
sp->num_ngb_density = 0; sp->num_ngb_density = 0;
#endif #endif
...@@ -156,6 +157,7 @@ __attribute__((always_inline)) INLINE static void stars_evolve_spart( ...@@ -156,6 +157,7 @@ __attribute__((always_inline)) INLINE static void stars_evolve_spart(
__attribute__((always_inline)) INLINE static void stars_reset_acceleration( __attribute__((always_inline)) INLINE static void stars_reset_acceleration(
struct spart* restrict p) { struct spart* restrict p) {
#ifdef DEBUG_INTERACTIONS_STARS #ifdef DEBUG_INTERACTIONS_STARS
for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS_STARS; ++i) p->ids_ngbs_force[i] = -1;
p->num_ngb_force = 0; p->num_ngb_force = 0;
#endif #endif
} }
......
...@@ -32,6 +32,10 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj, ...@@ -32,6 +32,10 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj,
si->density.wcount_dh -= (hydro_dimension * wi + ui * wi_dx); si->density.wcount_dh -= (hydro_dimension * wi + ui * wi_dx);
#ifdef DEBUG_INTERACTIONS_STARS #ifdef DEBUG_INTERACTIONS_STARS
/* Update ngb counters */
if (si->num_ngb_density < MAX_NUM_OF_NEIGHBOURS_STARS)
si->ids_ngbs_density[si->num_ngb_density] = pj->id;
/* Update ngb counters */ /* Update ngb counters */
++si->num_ngb_density; ++si->num_ngb_density;
#endif #endif
...@@ -55,6 +59,10 @@ runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj, ...@@ -55,6 +59,10 @@ runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj,
struct part *restrict pj, float a, float H) { struct part *restrict pj, float a, float H) {
#ifdef DEBUG_INTERACTIONS_STARS #ifdef DEBUG_INTERACTIONS_STARS
/* Update ngb counters */
if (si->num_ngb_force < MAX_NUM_OF_NEIGHBOURS_STARS)
si->ids_ngbs_force[si->num_ngb_force] = pj->id;
/* Update ngb counters */ /* Update ngb counters */
++si->num_ngb_force; ++si->num_ngb_force;
#endif #endif
......
...@@ -78,12 +78,18 @@ INLINE static void stars_write_particles(const struct spart *sparts, ...@@ -78,12 +78,18 @@ INLINE static void stars_write_particles(const struct spart *sparts,
#ifdef DEBUG_INTERACTIONS_STARS #ifdef DEBUG_INTERACTIONS_STARS
list += *num_fields; list += *num_fields;
*num_fields += 2; *num_fields += 4;
list[0] = io_make_output_field("Num_ngb_density", INT, 1, UNIT_CONV_NO_UNITS, list[0] = io_make_output_field("Num_ngb_density", INT, 1, UNIT_CONV_NO_UNITS,
sparts, num_ngb_density); sparts, num_ngb_density);
list[1] = io_make_output_field("Num_ngb_force", INT, 1, UNIT_CONV_NO_UNITS, list[1] = io_make_output_field("Num_ngb_force", INT, 1, UNIT_CONV_NO_UNITS,
sparts, num_ngb_force); sparts, num_ngb_force);
list[2] =
io_make_output_field("Ids_ngb_density", LONGLONG, MAX_NUM_OF_NEIGHBOURS_STARS,
UNIT_CONV_NO_UNITS, sparts, ids_ngbs_density);
list[3] =
io_make_output_field("Ids_ngb_force", LONGLONG, MAX_NUM_OF_NEIGHBOURS_STARS,
UNIT_CONV_NO_UNITS, sparts, ids_ngbs_force);
#endif #endif
} }
......
...@@ -89,8 +89,14 @@ struct spart { ...@@ -89,8 +89,14 @@ struct spart {
/*! Number of interactions in the density SELF and PAIR */ /*! Number of interactions in the density SELF and PAIR */
int num_ngb_density; int num_ngb_density;
/*! Number of interactions in the force SELF and PAIR */ /*! List of interacting particles in the density SELF and PAIR */
long long ids_ngbs_density[MAX_NUM_OF_NEIGHBOURS_STARS];
/*! Number of interactions in the force SELF and PAIR */
int num_ngb_force; int num_ngb_force;
/*! List of interacting particles in the force SELF and PAIR */
long long ids_ngbs_force[MAX_NUM_OF_NEIGHBOURS_STARS];
#endif #endif
} SWIFT_STRUCT_ALIGN; } SWIFT_STRUCT_ALIGN;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment