Changeset 438 for trunk/matml

Show
Ignore:
Timestamp:
03/16/2009 03:46:32 PM (3 years ago)
Author:
powell
Message:

Added #ifdef DEBUG around printfs to put them aside until needed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/matml/src/ternary/qhull.c

    r437 r438  
    726726  *n_bounds = 0; 
    727727 
     728#ifdef DEBUG 
    728729  printf ("Starting ReturnPhaseBoundaries with %d facets, %d points\n", 
    729730          n_facets, n_points); 
    730  
    731   printf ("Last facet %d vertices %d, %d, %d\n", n_facets-1, 
    732           facets[n_facets-1].vertex[0], facets[n_facets-1].vertex[1], 
    733           facets[n_facets-1].vertex[2]); 
     731#endif 
    734732 
    735733  for (f=0; f<n_facets; f++) 
     
    738736        v2 = facets[f].vertex[2]; 
    739737 
     738#ifdef DEBUG 
    740739      printf ("Facet %d: type %d, vertices %d ",f, facets [f].type, v0); 
    741740      printf ("(%d), %d (%d), %d(%d)\n", 
     
    743742              points[v1].efunc, v2, points[v2].efunc); 
    744743      fflush (stdout); 
     744#endif 
    745745 
    746746      switch (facets [f].type) 
     
    774774                // No boundary with these three phases, make a new one 
    775775                bound = *n_bounds; 
     776#ifdef DEBUG 
    776777                printf ("Making new three-phase boundary %d\n", *n_bounds); 
     778#endif 
    777779                if (!(*boundaries = realloc 
    778780                      (*boundaries, (*n_bounds+1) * sizeof (phase_boundary)))) 
     
    794796                (*boundaries) [bound].edges [2] = MAX3 (v0, v1, v2); 
    795797                (*n_bounds) ++; 
     798#ifdef DEBUG 
    796799                printf ("  Corners for bound %d edge 0: %d, %d, %d\n", bound, 
    797800                        (*boundaries) [bound].edges [0], 
    798801                        (*boundaries) [bound].edges [1], 
    799802                        (*boundaries) [bound].edges [2]); 
     803#endif 
    800804              } 
    801805            else 
     
    804808                // that we need not worry about the realloc overhead 
    805809                int e = (*boundaries) [bound].n_edges; 
     810#ifdef DEBUG 
    806811                printf ("Ternary boundary %d adding edge %d\n",bound,e); 
     812#endif 
    807813                // All of these reallocs are pretty expensive... 
    808814                // Later use compos to store size of array, sort out later 
     
    814820                (*boundaries) [bound].edges [3*e+2] = MAX3 (v0, v1, v2); 
    815821                (*boundaries) [bound].n_edges += 1; 
     822#ifdef DEBUG 
    816823                printf ("  Corners for bound %d edge %d: %d, %d, %d\n", bound,e, 
    817824                        (*boundaries) [bound].edges [3*e], 
    818825                        (*boundaries) [bound].edges [3*e+1], 
    819826                        (*boundaries) [bound].edges [3*e+2]); 
     827#endif 
    820828              } 
    821829 
     
    852860                      G2 = points [v2].G; 
    853861 
     862#ifdef DEBUG 
    854863                    printf ("Misc gap: "); 
     864#endif 
    855865                    nphases=1; 
    856866 
     
    858868                        (G0+G1)/2) 
    859869                      { 
     870#ifdef DEBUG 
    860871                        printf ("v2 alone, Gav=%g, Gmid=%g\n", 
    861872                                (G0+G1)/2, free_energy ((C02+C12)/2,(C03+C13)/2,T,P,eparams+phase0)); 
     873#endif 
    862874                        p0 = MIN (v0, v1); 
    863875                        p1 = MAX (v0, v1); 
     
    867879                             (G0+G2)/2) 
    868880                      { 
     881#ifdef DEBUG 
    869882                        printf ("v1 alone, Gav=%g, Gmid=%g\n", 
    870883                                (G0+G2)/2, free_energy ((C02+C22)/2,(C03+C23)/2,T,P,eparams+phase0)); 
     884#endif 
    871885                        p0 = MIN (v0, v2); 
    872886                        p1 = MAX (v0, v2); 
     
    875889                    else 
    876890                      { 
     891#ifdef DEBUG 
    877892                        printf ("v0 alone, Gav=%g, Gmid=%g\n", 
    878893                                (G1+G2)/2, free_energy ((C22+C12)/2,(C23+C13)/2,T,P,eparams+phase0)); 
     894#endif 
    879895                        p0 = MIN (v1, v2); 
    880896                        p1 = MAX (v1, v2); 
     
    908924                bound = *n_bounds; 
    909925                // No boundary with these two phases, make a new one 
     926#ifdef DEBUG 
    910927                printf ("Making new tie-line boundary %d\n", *n_bounds); 
     928#endif 
    911929                if (!(*boundaries = realloc 
    912930                      (*boundaries, (*n_bounds+1) * sizeof (phase_boundary)))) 
     
    940958            (*boundaries) [bound].edges [2*e+2] = MIN (p1, p2); 
    941959            (*boundaries) [bound].edges [2*e+3] = MAX (p1, p2); 
     960#ifdef DEBUG 
    942961            printf ("  Corners for bound %d edges %d,%d: %d,%d, %d,%d\n", 
    943962                    bound, e, e+1, (*boundaries) [bound].edges [2*e], 
     
    945964                    (*boundaries) [bound].edges [2*e+2], 
    946965                    (*boundaries) [bound].edges [2*e+3]); 
     966#endif 
    947967 
    948968            // Check for a boundary with an edge on the "majority" phase 
     
    958978                // No boundary with these two phases, make a new one 
    959979                bound = *n_bounds; 
     980#ifdef DEBUG 
    960981                printf ("Making new phase edge boundary %d\n", *n_bounds); 
     982#endif 
    961983                if (!(*boundaries = realloc 
    962984                      (*boundaries, (bound+1) * sizeof (phase_boundary)))) 
     
    9861008            (*boundaries) [bound].edges [2*e+1] = MAX (p0, p1); 
    9871009            (*boundaries) [bound].n_edges += 1; 
     1010#ifdef DEBUG 
    9881011            printf ("  Corners for bound %d edge %d: %d,%d\n", 
    9891012                    bound, e, (*boundaries) [bound].edges [2*e], 
    9901013                    (*boundaries) [bound].edges [2*e+1]); 
     1014#endif 
    9911015 
    9921016            break; 
     
    9951019        case CRITICAL_POINT: 
    9961020          { 
     1021#ifdef DEBUG 
    9971022            printf ("Critical point case\n"); 
     1023#endif 
    9981024            int b=0, bound=-1, p0, p1, p2, e=0, phase = points [v0].efunc; 
    9991025            double C02 = points [v0].C2, C03 = points [v0].C3, 
     
    10061032                (G0+G1)/2) 
    10071033              { 
     1034#ifdef DEBUG 
    10081035                printf ("v2 alone, Gav=%g, Gmid=%g\n", 
    10091036                        (G0+G1)/2, free_energy ((C02+C12)/2,(C03+C13)/2,T,P,eparams+phase)); 
     1037#endif 
    10101038                p0 = MIN (v0, v1); 
    10111039                p1 = MAX (v0, v1); 
     
    10151043                     (G0+G2)/2) 
    10161044              { 
     1045#ifdef DEBUG 
    10171046                printf ("v1 alone, Gav=%g, Gmid=%g\n", 
    10181047                        (G0+G2)/2, free_energy ((C02+C22)/2,(C03+C23)/2,T,P,eparams+phase)); 
     1048#endif 
    10191049                p0 = MIN (v0, v2); 
    10201050                p1 = MAX (v0, v2); 
     
    10231053            else 
    10241054              { 
     1055#ifdef DEBUG 
    10251056                printf ("v0 alone, Gav=%g, Gmid=%g\n", 
    10261057                        (G1+G2)/2, free_energy ((C22+C12)/2,(C23+C13)/2,T,P,eparams+phase)); 
     1058#endif 
    10271059                p0 = MIN (v1, v2); 
    10281060                p1 = MAX (v1, v2); 
     
    10411073                bound = *n_bounds; 
    10421074                // No tie-line boundary in this phase, make a new one 
     1075#ifdef DEBUG 
    10431076                printf ("Making new tie-line boundary %d\n", *n_bounds); 
     1077#endif 
    10441078                if (!(*boundaries = realloc 
    10451079                      (*boundaries, (*n_bounds+1) * sizeof (phase_boundary)))) 
     
    10691103            (*boundaries) [bound].edges [2*e]   = MIN (p0, p1); 
    10701104            (*boundaries) [bound].edges [2*e+1] = MAX (p0, p1); 
     1105#ifdef DEBUG 
    10711106            printf ("  Corners for bound %d edges %d,%d: %d,%d\n", 
    10721107                    bound, e, e+1, (*boundaries) [bound].edges [2*e], 
    10731108                    (*boundaries) [bound].edges [2*e+1]); 
     1109#endif 
    10741110 
    10751111            // Check for a boundary with an edge on this miscibility gap 
     
    10841120                // No edge boundary with this miscibility gap, make a new one 
    10851121                bound = *n_bounds; 
     1122#ifdef DEBUG 
    10861123                printf ("Making new phase edge boundary %d\n", *n_bounds); 
     1124#endif 
    10871125                if (!(*boundaries = realloc 
    10881126                      (*boundaries, (bound+1) * sizeof (phase_boundary)))) 
     
    11121150            (*boundaries) [bound].edges [2*e+3] = MAX (p1, p2); 
    11131151            (*boundaries) [bound].n_edges += 2; 
     1152#ifdef DEBUG 
    11141153            printf ("  Corners for bound %d edge %d: %d,%d, %d,%d\n", 
    11151154                    bound, e, (*boundaries) [bound].edges [2*e], 
     
    11171156                    (*boundaries) [bound].edges [2*e+2], 
    11181157                    (*boundaries) [bound].edges [2*e+3]); 
     1158#endif 
    11191159 
    11201160            break;