commit 6fba7f184af58122623eadbe40e902759fef2a25
parent 24351f33993e14a88dd9cfb9787752bd4c912af2
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Wed, 16 Mar 2016 13:42:51 -0700
add file for centralized debug flags
Diffstat:
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/debug.h b/debug.h
@@ -0,0 +1,8 @@
+#ifndef DEBUG_H_
+#define DEBUG_H_
+
+// if defined, verbose information to stdout will be shown during the
+// slider-bond initialization function
+#define DEBUG_FIND_AND_BOND_TO_NEIGHBORS
+
+#endif
diff --git a/grid.c b/grid.c
@@ -3,6 +3,7 @@
#include "typedefs.h"
#include "slider.h"
#include "vector_math.h"
+#include "debug.h"
slider* create_regular_slider_grid(
const int nx,
@@ -49,11 +50,20 @@ void find_and_bond_to_neighbors_n2(
dist = subtract_float3(sliders[i].pos, sliders[j].pos);
dist_norm = norm_float3(dist);
+#ifdef DEBUG_FIND_AND_BOND_TO_NEIGHBORS
+ printf("i=%d, j=%d, dist = %f %f %f, dist_norm = %f, "
+ "cutoff = %f\n",
+ i, j,
+ dist.x, dist.y, dist.z,
+ dist_norm, cutoff);
+#endif
+
if (dist_norm < cutoff) {
sliders[i].neighbors[n_neighbors++] = j;
if (n_neighbors == MAX_NEIGHBORS - 1)
- fprintf(stderr, "Error: MAX_NEIGHBORS exceeded.\n");
+ fprintf(stderr, "Error: MAX_NEIGHBORS exceeded for "
+ "slider %d.\n", i);
}
}
}