Changeset 328

Show
Ignore:
Timestamp:
03/26/08 15:00:25 (8 months ago)
Author:
powell
Message:

New qhull calculation of convex hull of vertices.

Location:
trunk/matml/src/ternary
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/matml/src/ternary/Makefile.am

    r325 r328  
    1111bin_PROGRAMS    = ternary 
    1212noinst_HEADERS  = ternary.h 
    13 ternary_SOURCES = ternary.c geomview.c freenergy.c 
    14 ternary_CFLAGS  = -DGEOMVIEW=\"@GEOMVIEW@\" 
    15 ternary_LDADD   = -lm 
     13ternary_SOURCES = ternary.c geomview.c qhull.c freenergy.c 
     14ternary_CFLAGS  = -DGEOMVIEW=\"@GEOMVIEW@\" -DDEBUG 
     15ternary_LDADD   = -lm -lqhull 
    1616 
    1717EXTRA_DIST = macros/autogen.sh macros/cxref-latex.m4 
     
    2222                 $(top_srcdir)/ternary.h.tex \ 
    2323                 $(top_srcdir)/geomview.c.tex \ 
     24                 $(top_srcdir)/qhull.c.tex \ 
    2425                 $(top_srcdir)/freenergy.c.tex 
    2526 
  • trunk/matml/src/ternary/ternary.c

    r321 r328  
    2828int main (int argc, char *argv[]) 
    2929{ 
    30   int i, j, index, loop_max=50, *verts; 
    31   char gv_version[100]; 
     30  int i, j, index, loop_max=50, *verts, hullnumverts, *hullverts=NULL; 
     31  char gv_version[100], *qh_version; 
    3232  FILE *pfd = NULL; 
    3333  double Gmin, Gmax; 
     
    6565      } 
    6666 
    67   printf ("Calculated free energies\n"); 
    68  
    6967#define Grel(G) (((G)-Gmin)/(Gmax-Gmin)) 
    7068#define RED(G) (((G)<.25) ? 1. : (((G)<.5) ? 2.-4.*(G) : 0.)) 
     
    8886        points[index].alpha = 1.; 
    8987      } 
    90  
    91   printf ("Rescaled points\n"); 
    9288 
    9389  /* Calculate triangle vertex indices */ 
     
    115111  verts [3*index+2] = ROWSTART(i+1); 
    116112 
    117   printf ("Calculated triangle vertex indices\n"); 
    118  
    119113  /* Send points and triangle vertex data to Geomview */ 
    120114  if (i=GeomviewDisplayTriangleCOFF (pfd, (loop_max+1)*(loop_max+2)/2, points, 
     
    122116    { printf ("main: Error %d in Geomview Display\n", i); exit (i); } 
    123117 
    124   printf ("Sent points to geomview\n"); 
     118  printf ("Calling qhull\n"); 
     119  if (i=qhullCalcHull (3, (loop_max+1)*(loop_max+2)/2, points, &hullnumverts, 
     120                       &hullverts, &qh_version)) 
     121    { printf ("main: qhullCalcHull returned %d\n", i); exit (i); } 
     122  printf ("qhull version: %s\n", qh_version); 
    125123 
    126   { 
    127     char instring[100]; 
    128  
    129     printf ("Press <return> to close up... "); 
    130     fgets (instring, 99, stdin); 
    131   } 
     124  printf ("Press <return> to close up... "); 
     125  fgets (gv_version, 99, stdin); 
    132126 
    133127  GeomviewEnd (&pfd); 
    134128  free (points); 
    135129  free (verts); 
     130  free (hullverts); 
    136131 
    137132  return 0; 
  • trunk/matml/src/ternary/ternary.h

    r321 r328  
    3232int GeomviewEnd (FILE **geompipe); 
    3333 
     34int qhullCalcHull (int dim, int numpoints, ternary_point *points, int *facets, 
     35                   int **verts, char **version); 
     36 
    3437#endif /* TERNARY_H */