#include <string.h>
#include <vector>
-enum {DEBUG=0};
+enum {MINGLE_DEBUG=0};
static Agglomerative_Ink_Bundling Agglomerative_Ink_Bundling_init(SparseMatrix A, pedge *edges, int level){
Agglomerative_Ink_Bundling grid;
pick[0] = i; pick[1] = jj;
ni = nj = 1;
}
- if (DEBUG) if (Verbose) fprintf(stderr, "ink(%d)=%f, ink(%d)=%f", i, inki, jj, inkj);
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr, "ink(%d)=%f, ink(%d)=%f", i, inki, jj, inkj);
} else {
/* j is already matched. Its content is on cedges[jc] */
inki = inks[i]; inkj = cinks[jc];
- if (DEBUG) if (Verbose) fprintf(stderr, "ink(%d)=%f, ink(%d->%d)=%f", i, inki, jj, jc, inkj);
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr, "ink(%d)=%f, ink(%d->%d)=%f", i, inki, jj, jc, inkj);
if (ip) {
ni = (ip[i+1] - ip[i]);/* number of edges represented by i */
memcpy(pick, &(jp[ip[i]]), sizeof(int)*ni);
npicks = ni + nj;
ink1 = ink(edges, npicks, pick, &ink0, &meet1, &meet2, angle_param, angle);
- if (DEBUG) {
+ if (MINGLE_DEBUG) {
if (Verbose) {
fprintf(stderr,", if merging {");
for (k = 0; k < npicks; k++) fprintf(stderr,"%d,", pick[k]);
}
gain = inki + inkj - ink1;
- if (DEBUG) if (Verbose) fprintf(stderr, " gain=%f", gain);
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr, " gain=%f", gain);
if (gain > maxgain){
maxgain = gain;
minink = ink1;
jmax = jj;
- if (DEBUG) if (Verbose) fprintf(stderr, "maxgain=%f", maxgain);
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr, "maxgain=%f", maxgain);
}
- if (DEBUG) if (Verbose) fprintf(stderr, "\n");
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr, "\n");
total_gain += maxgain;
jc = matching[jmax];
if (jc == UNMATCHED){/* i and j both unmatched. Add j in the table first */
- if (DEBUG) if (Verbose) printf("maxgain=%f, merge %d with best edge: %d to form coarsen edge %d. Ink=%f\n",maxgain, i, jmax, nc, minink);
+ if (MINGLE_DEBUG) if (Verbose) printf("maxgain=%f, merge %d with best edge: %d to form coarsen edge %d. Ink=%f\n",maxgain, i, jmax, nc, minink);
matching[i] = matching[jmax] = nc;
if (ip){
for (k = ip[jmax]; k < ip[jmax+1]; k++) {
jc = nc;
nc++;
} else {/*j is already matched */
- if (DEBUG) if (Verbose) printf("maxgain=%f, merge %d with existing cluster %d\n",maxgain, i, jc);
+ if (MINGLE_DEBUG) if (Verbose) printf("maxgain=%f, merge %d with existing cluster %d\n",maxgain, i, jc);
matching[i] = jc;
grand_total_ink -= cinks[jc];/* ink of cluster jc was already added, and will be added again as part of a larger cluster with i, so dicount */
}
} else {/*i can not match/bundle successfully */
- if (DEBUG) if (Verbose) fprintf(stderr, "no gain in bundling node %d\n",i);
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr, "no gain in bundling node %d\n",i);
assert(maxgain <= 0);
matching[i] = nc;
jc = nc;
grand_total_ink += minink;
grand_total_gain += maxgain;
- if (DEBUG){
+ if (MINGLE_DEBUG){
if (Verbose) {
fprintf(stderr," coarse edge[%d]={",jc);
for (const int &cedge : cedges[jc]) {
for (i = 0; i < R->m; i++){
pick = &(ja[ia[i]]);
- if (DEBUG) if (Verbose) fprintf(stderr,"calling ink2...\n");
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr,"calling ink2...\n");
ink1 = ink(edges, ia[i+1]-ia[i], pick, &ink0, &meet1, &meet2, angle_param, angle);
- if (DEBUG) if (Verbose) fprintf(stderr,"finish calling ink2...\n");
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr,"finish calling ink2...\n");
assert(fabs(ink1 - cgrid->inks[i])<=MAX(TOL, TOL*ink1) && ink1 - ink0 <= TOL);
assert(ink1 < 1000 * ink0); /* assert that points were found */
wgt_all = 0.;
pick = &(ja[ia[i]]);
wgt = 0.;
for (j = ia[i]; j < ia[i+1]; j++) wgt += edges[j]->wgt;
- if (DEBUG) if (Verbose) fprintf(stderr,"calling ink3...\n");
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr,"calling ink3...\n");
ink1 = ink(edges, ia[i+1]-ia[i], pick, &ink0, &meet1, &meet2, angle_param, angle);
- if (DEBUG) if (Verbose) fprintf(stderr,"done calling ink3...\n");
+ if (MINGLE_DEBUG) if (Verbose) fprintf(stderr,"done calling ink3...\n");
assert(fabs(ink1 - cgrid->inks[i])<=MAX(TOL, TOL*ink1) && ink1 - ink0 <= TOL);
assert(ink1 < 1000 * ink0); /* assert that points were found */
xx[i*4 + 0] = meet1.x;