From e2a49f88e17504dbe146c68f0754768f75c44a15 Mon Sep 17 00:00:00 2001
From: James Willis <james.s.willis@durham.ac.uk>
Date: Sat, 7 Oct 2017 18:04:34 +0100
Subject: [PATCH] Removed debugging of interactions.

---
 src/cache.h                    |  2 -
 src/hydro/Gadget2/hydro.h      | 10 -----
 src/hydro/Gadget2/hydro_iact.h | 34 ---------------
 src/hydro/Gadget2/hydro_io.h   | 15 -------
 src/hydro/Gadget2/hydro_part.h | 18 --------
 src/runner_doiact_vec.c        | 76 ----------------------------------
 6 files changed, 155 deletions(-)

diff --git a/src/cache.h b/src/cache.h
index d77f4a3999..a08698989f 100644
--- a/src/cache.h
+++ b/src/cache.h
@@ -30,8 +30,6 @@
 #include "sort_part.h"
 #include "vector.h"
 
-#include <float.h>
-
 #define NUM_VEC_PROC 2
 #define C2_CACHE_SIZE (NUM_VEC_PROC * VEC_SIZE * 6) + (NUM_VEC_PROC * VEC_SIZE)
 
diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h
index ad927ed2c5..66a475f32e 100644
--- a/src/hydro/Gadget2/hydro.h
+++ b/src/hydro/Gadget2/hydro.h
@@ -175,11 +175,6 @@ __attribute__((always_inline)) INLINE static void hydro_timestep_extra(
 __attribute__((always_inline)) INLINE static void hydro_init_part(
     struct part *restrict p, const struct hydro_space *hs) {
 
-#ifdef DEBUG_INTERACTIONS
-  for (int i = 0; i < NUM_OF_NEIGHBOURS; ++i) p->ids_ngbs_density[i] = -1;
-  p->num_ngb_density = 0;
-#endif
-  
   p->rho = 0.f;
   p->density.wcount = 0.f;
   p->density.wcount_dh = 0.f;
@@ -316,11 +311,6 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
 __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
     struct part *restrict p) {
 
-#ifdef DEBUG_INTERACTIONS
-  for (int i = 0; i < NUM_OF_NEIGHBOURS; ++i) p->ids_ngbs_force[i] = -1;
-  p->num_ngb_force = 0;
-#endif
-  
   /* Reset the acceleration. */
   p->a_hydro[0] = 0.0f;
   p->a_hydro[1] = 0.0f;
diff --git a/src/hydro/Gadget2/hydro_iact.h b/src/hydro/Gadget2/hydro_iact.h
index a8affdc6e1..fff2d50724 100644
--- a/src/hydro/Gadget2/hydro_iact.h
+++ b/src/hydro/Gadget2/hydro_iact.h
@@ -104,14 +104,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
   pj->density.rot_v[1] += facj * curlvr[1];
   pj->density.rot_v[2] += facj * curlvr[2];
   
-  /* Update ngb counters */
-#ifdef DEBUG_INTERACTIONS
-  if(pi->id == CHECK_PART_ID) pi->ids_ngbs_density[pi->num_ngb_density] = pj->id;
-  ++pi->num_ngb_density;
-  if(pj->id == CHECK_PART_ID) pj->ids_ngbs_density[pj->num_ngb_density] = pi->id;
-  ++pj->num_ngb_density;
-#endif
-
 }
 
 /**
@@ -161,12 +153,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
   pi->density.rot_v[1] += fac * curlvr[1];
   pi->density.rot_v[2] += fac * curlvr[2];
   
-#ifdef DEBUG_INTERACTIONS
-  /* Update ngb counters */
-  if(pi->id == CHECK_PART_ID) pi->ids_ngbs_density[pi->num_ngb_density] = pj->id;
-  ++pi->num_ngb_density;
-#endif
-
 }
 
 #ifdef WITH_VECTORIZATION
@@ -497,18 +483,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
   pi->entropy_dt += mj * visc_term * dvdr;
   pj->entropy_dt += mi * visc_term * dvdr;
   
-#ifdef DEBUG_INTERACTIONS
-  /* Update ngb counters */
-  if(pi->id == CHECK_PART_ID) {
-    pi->ids_ngbs_force[pi->num_ngb_force] = pj->id;
-  }
-  ++pi->num_ngb_force;
-  if(pj->id == CHECK_PART_ID) {
-    pj->ids_ngbs_force[pj->num_ngb_force] = pi->id;
-  }
-  ++pj->num_ngb_force;
-#endif
-
 }
 
 /**
@@ -599,14 +573,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   /* Change in entropy */
   pi->entropy_dt += mj * visc_term * dvdr;
   
-#ifdef DEBUG_INTERACTIONS
-  /* Update ngb counters */
-  if(pi->id == CHECK_PART_ID) {
-    pi->ids_ngbs_force[pi->num_ngb_force] = pj->id;
-  }
-  ++pi->num_ngb_force;
-#endif
-
 }
 
 #ifdef WITH_VECTORIZATION
diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h
index f4b1cca41d..3e46b2351e 100644
--- a/src/hydro/Gadget2/hydro_io.h
+++ b/src/hydro/Gadget2/hydro_io.h
@@ -77,10 +77,6 @@ void hydro_write_particles(struct part* parts, struct io_props* list,
 
   *num_fields = 10;
 
-#ifdef DEBUG_INTERACTIONS
-  *num_fields = 14;
-#endif
-
   /* List what we want to write */
   list[0] = io_make_output_field("Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH,
                                  parts, x);
@@ -103,17 +99,6 @@ void hydro_write_particles(struct part* parts, struct io_props* list,
                                               parts, rho, convert_u);
   list[9] = io_make_output_field_convert_part(
       "Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, rho, convert_P);
-#ifdef DEBUG_INTERACTIONS
-  list[10] = io_make_output_field("Num_ngb_density", INT, 1, UNIT_CONV_NO_UNITS,
-                                 parts, num_ngb_density);
-  list[11] = io_make_output_field("Num_ngb_force", INT, 1, UNIT_CONV_NO_UNITS,
-                                 parts, num_ngb_force);
-  list[12] = io_make_output_field("Ids_ngb_density", LONGLONG, NUM_OF_NEIGHBOURS,
-                                 UNIT_CONV_NO_UNITS, parts, ids_ngbs_density);
-  list[13] = io_make_output_field("Ids_ngb_force", LONGLONG, NUM_OF_NEIGHBOURS,
-                                 UNIT_CONV_NO_UNITS, parts, ids_ngbs_force);
-#endif
-
 }
 
 /**
diff --git a/src/hydro/Gadget2/hydro_part.h b/src/hydro/Gadget2/hydro_part.h
index 52ff778f7e..571aaf39ed 100644
--- a/src/hydro/Gadget2/hydro_part.h
+++ b/src/hydro/Gadget2/hydro_part.h
@@ -33,10 +33,6 @@
 
 #include "cooling_struct.h"
 
-#define NUM_OF_NEIGHBOURS 128
-#define CHECK_PART_ID 999999999999999999999
-//#define CHECK_PART_ID 5673486482283
-
 /* Extra particle data not needed during the SPH loops over neighbours. */
 struct xpart {
 
@@ -147,20 +143,6 @@ struct part {
 
 #endif
 
-#ifdef DEBUG_INTERACTIONS
-  /*! List of interacting particles in the density SELF and PAIR */
-  long long ids_ngbs_density[NUM_OF_NEIGHBOURS];
-
-  /*! List of interacting particles in the force SELF and PAIR */
-  long long ids_ngbs_force[NUM_OF_NEIGHBOURS];
-
-  /*! Number of interactions in the density SELF and PAIR */
-  int num_ngb_density;
-
-  /*! Number of interactions in the force SELF and PAIR */
-  int num_ngb_force;
-#endif
-
 } SWIFT_STRUCT_ALIGN;
 
 #endif /* SWIFT_GADGET2_HYDRO_PART_H */
diff --git a/src/runner_doiact_vec.c b/src/runner_doiact_vec.c
index 725ee52a0c..f478d6932d 100644
--- a/src/runner_doiact_vec.c
+++ b/src/runner_doiact_vec.c
@@ -634,26 +634,6 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec(
       doi_mask = doi_mask & doi_mask_self_check;
       doi_mask2 = doi_mask2 & doi_mask2_self_check;
 
-#ifdef DEBUG_INTERACTIONS
-      for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
-        if (doi_mask & (1 << bit_index)) {
-          if(pi->id == CHECK_PART_ID) {
-            pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + bit_index].id;
-          }
-          ++pi->num_ngb_density;
-        }
-      }
-      
-      for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
-        if (doi_mask2 & (1 << bit_index)) {
-          if(pi->id == CHECK_PART_ID) {
-            pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + VEC_SIZE + bit_index].id;
-          }
-          ++pi->num_ngb_density;
-        }
-      }
-#endif
-
       /* If there are any interactions left pack interaction values into c2
        * cache. */
       if (doi_mask) {
@@ -873,17 +853,6 @@ __attribute__((always_inline)) INLINE void runner_doself2_force_vec(
       vec_combine_masks(v_doi_mask, v_doi_mask_self_check);
       doi_mask = vec_form_int_mask(v_doi_mask);
 
-#ifdef DEBUG_INTERACTIONS
-      for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
-        if (doi_mask & (1 << bit_index)) {
-          if(pi->id == CHECK_PART_ID) {
-            pi->ids_ngbs_force[pi->num_ngb_force] = parts[pjd + bit_index].id;
-          }
-          ++pi->num_ngb_force;
-        }
-      }
-#endif
-
       /* If there are any interactions perform them. */
       if (doi_mask) {
         vector v_hj_inv;
@@ -1142,17 +1111,6 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
         /* Form integer mask. */
         doi_mask = vec_form_int_mask(v_doi_mask);
 
-#ifdef DEBUG_INTERACTIONS
-        for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
-          if (doi_mask & (1 << bit_index)) {
-            if(pi->id == CHECK_PART_ID) {
-              pi->ids_ngbs_density[pi->num_ngb_density] = parts_j[sort_j[pjd + bit_index].i].id;
-            }
-            ++pi->num_ngb_density;
-          }
-        }
-#endif
-
         /* If there are any interactions perform them. */
         if (doi_mask)
           runner_iact_nonsym_1_vec_density(
@@ -1284,17 +1242,6 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
         /* Form integer mask. */
         doj_mask = vec_form_int_mask(v_doj_mask);
 
-#ifdef DEBUG_INTERACTIONS
-        for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
-          if (doj_mask & (1 << bit_index)) {
-            if(pj->id == CHECK_PART_ID) {
-              pj->ids_ngbs_density[pj->num_ngb_density] = parts_i[sort_i[ci_cache_idx + first_pi_align + bit_index].i].id;
-            }
-            ++pj->num_ngb_density;
-          }
-        }
-#endif
-
         /* If there are any interactions perform them. */
         if (doj_mask)
           runner_iact_nonsym_1_vec_density(
@@ -1434,7 +1381,6 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
   last_pj = max(last_pj, max_index_i[count_i - 1]);
   first_pi = min(first_pi, max_index_j[0]);
   
-
   /* Read the needed particles into the two caches. */
   int first_pi_align = first_pi;
   int last_pj_align = last_pj;
@@ -1557,17 +1503,6 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
         /* Form integer masks. */
         doi_mask = vec_form_int_mask(v_doi_mask);
 
-#ifdef DEBUG_INTERACTIONS
-        for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
-          if (doi_mask & (1 << bit_index)) {
-            if(pi->id == CHECK_PART_ID) {
-              pi->ids_ngbs_force[pi->num_ngb_force] = parts_j[sort_j[pjd + bit_index].i].id;
-            }
-            ++pi->num_ngb_force;
-          }
-        }
-#endif
-
         /* If there are any interactions perform them. */
         if (doi_mask) {
           vector v_hj_inv;
@@ -1710,17 +1645,6 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
         /* Form integer masks. */
         doj_mask = vec_form_int_mask(v_doj_mask);
 
-#ifdef DEBUG_INTERACTIONS
-        for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
-          if (doj_mask & (1 << bit_index)) {
-            if(pj->id == CHECK_PART_ID) {
-              pj->ids_ngbs_force[pj->num_ngb_force] = parts_i[sort_i[ci_cache_idx + first_pi_align + bit_index].i].id;
-            }
-            ++pj->num_ngb_force;
-          }
-        }
-#endif
-
         /* If there are any interactions perform them. */
         if (doj_mask) {
           vector v_hi_inv;
-- 
GitLab