]> granicus.if.org Git - graphviz/commitdiff
if (Verbose) around fprintf's in aspect code
authorellson <devnull@localhost>
Tue, 7 Oct 2008 14:58:23 +0000 (14:58 +0000)
committerellson <devnull@localhost>
Tue, 7 Oct 2008 14:58:23 +0000 (14:58 +0000)
lib/dotgen/dotinit.c
lib/dotgen/position.c

index fca40d194131d14a7e24db496aaf2b706f7ad8a4..7b9da685b59dafa4b85a841b4264765a919c3009 100644 (file)
@@ -240,6 +240,7 @@ extern int curIterations;
 int nextiter;
 int packiter = 0;
 int nPasses = 0;
+
 double start, finish, totalCLK;
 
 void dot_layout(Agraph_t * g)
@@ -247,10 +248,7 @@ void dot_layout(Agraph_t * g)
 
     setEdgeType (g, ET_SPLINE);
 
-#ifdef ASPECT
-    start = clock();
     nextiter = -1;
-#endif
 
     dot_init_node_edge(g);
 
@@ -258,50 +256,47 @@ void dot_layout(Agraph_t * g)
     printf("Target AR = ");
     scanf("%lf", &targetAR);
 
+    do {
+        nPasses++;
+#endif
 
-    do{
-
-    nPasses++;
+        start = clock();
+        dot_rank(g);
+        packiter += curIterations;
 
-#endif
-    dot_rank(g);
-    packiter += curIterations;
+        dot_mincross(g);
+        /* dumpRanks (g); */
 
-    dot_mincross(g);
-    /* dumpRanks (g); */
+        dot_position(g);
 
-    dot_position(g);
+        finish = clock();
+        totalCLK += finish - start;
 
 #ifdef ASPECT
-    char response[100];
-    finish = clock();
-    totalCLK += finish - start;
-
-    printf("Continue: yes/no/enter # of iterations? (y/n/i)");
-    scanf("%s",response);
-    if (!strcmp(response, "n") || !strcmp(response, "N"))
-      break;
-    else if (!strcmp(response, "i") || !strcmp(response, "I"))
-    {
-      printf("Enter # of iterations: ");
-      scanf("%d", &nextiter);
-    }
-   
-    start = clock();
-
+        char response[100];
+        printf("Continue: yes/no/enter # of iterations? (y/n/i)");
+        scanf("%s",response);
+        if (!strcmp(response, "n") || !strcmp(response, "N"))
+            break;
+        else if (!strcmp(response, "i") || !strcmp(response, "I"))
+        {
+            printf("Enter # of iterations: ");
+            scanf("%d", &nextiter);
+        }
     } while (nextiter);
 #endif
 
-
-    /* dumpRanks (g); */
     dot_sameports(g);
+
     dot_splines(g);
+
     if (mapbool(agget(g, "compound")))
        dot_compoundEdges(g);
+
     dotneato_postprocess(g);
 
-#ifdef ASPECT
-    printf("Packing iterations=%d\n# of Passes=%d\n", packiter, nPasses);
-    printf("Total time = %0.3lf sec\n\n", totalCLK/CLOCKS_PER_SEC);
-#endif
+    if (Verbose) {
+        fprintf(stderr, "Packing iterations=%d\n# of Passes=%d\n", packiter, nPasses);
+        fprintf(stderr, "Total time = %0.3lf sec\n\n", totalCLK/CLOCKS_PER_SEC);
+    }
 }
index f41059672f98d916aebd321b3a9017387e150db8..42b2ffe3cd4d88c8698cccc956eb67642e19ef36 100644 (file)
@@ -1039,8 +1039,10 @@ static void set_aspect(graph_t * g)
 
 #ifdef ASPECT
     double AR = (GD_bb(g).UR.x - GD_bb(g).LL.x)/(GD_bb(g).UR.y - GD_bb(g).LL.y);
-    printf("AR=%0.4lf\t Area= %0.4lf\t", AR, (double)(GD_bb(g).UR.x - GD_bb(g).LL.x)*(GD_bb(g).UR.y - GD_bb(g).LL.y)/10000.0);
-    printf("Dummy=%d\n", countDummyNodes(g));
+    if (Verbose) {
+        fprintf(stderr, "AR=%0.4lf\t Area= %0.4lf\t", AR, (double)(GD_bb(g).UR.x - GD_bb(g).LL.x)*(GD_bb(g).UR.y - GD_bb(g).LL.y)/10000.0);
+        fprintf(stderr, "Dummy=%d\n", countDummyNodes(g));
+    }
     if (AR > 1.1*targetAR)
     {
       nextiter = (int)(targetAR * (double)(curIterations - prevIterations)/(AR));
@@ -1048,10 +1050,14 @@ static void set_aspect(graph_t * g)
     else if (AR <= 0.8 * targetAR)
     {
       nextiter = -1;
-      printf("Going to apply another expansion.\n");
+      if (Verbose)
+        fprintf(stderr, "Going to apply another expansion.\n");
+    }
+    else {
+       nextiter = 0;
     }
-    else nextiter = 0;
-    printf("next#iter=%d\n", nextiter);
+    if (Verbose)
+        fprintf(stderr, "next#iter=%d\n", nextiter);
 #endif
 }