From: ellson Date: Tue, 7 Oct 2008 14:58:23 +0000 (+0000) Subject: if (Verbose) around fprintf's in aspect code X-Git-Tag: LAST_LIBGRAPH~32^2~3200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff67c9a11345d8be29863eb56a6455709ba97305;p=graphviz if (Verbose) around fprintf's in aspect code --- diff --git a/lib/dotgen/dotinit.c b/lib/dotgen/dotinit.c index fca40d194..7b9da685b 100644 --- a/lib/dotgen/dotinit.c +++ b/lib/dotgen/dotinit.c @@ -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); + } } diff --git a/lib/dotgen/position.c b/lib/dotgen/position.c index f41059672..42b2ffe3c 100644 --- a/lib/dotgen/position.c +++ b/lib/dotgen/position.c @@ -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 }