tadd file for centralized debug flags - slidergrid - grid of elastic sliders on a frictional surface
 (HTM) git clone git://src.adamsgaard.dk/slidergrid
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 6fba7f184af58122623eadbe40e902759fef2a25
 (DIR) parent 24351f33993e14a88dd9cfb9787752bd4c912af2
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Wed, 16 Mar 2016 13:42:51 -0700
       
       add file for centralized debug flags
       
       Diffstat:
         A debug.h                             |       8 ++++++++
         M grid.c                              |      12 +++++++++++-
       
       2 files changed, 19 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/debug.h b/debug.h
       t@@ -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
 (DIR) diff --git a/grid.c b/grid.c
       t@@ -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,
       t@@ -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);
                        }
                    }
                }