Changeset 381

Show
Ignore:
Timestamp:
06/27/08 15:00:20 (4 months ago)
Author:
powell
Message:

Small interface change.

Files:

Legend:

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

    r379 r381  
    2424  int dim Number of dimensions (should always be 3 for ternary). 
    2525 
     26  ternary_point *points Point information. 
     27 
    2628  int numpoints Number of points of which to calculate the convex hull. 
    27  
    28   ternary_point *points Point information. 
    2929  ++++++++++++++++++++++++++++++++++++++*/ 
    3030 
    31 int hullCalculate (int dim, int numpoints, ternary_point *points) 
     31int hullCalculate (int dim, ternary_point *points, int numpoints) 
    3232{ 
    3333  int i, corner1, corner2, corner3; 
     
    7878 
    7979/*++++++++++++++++++++++++++++++++++++++ 
    80   This uses Newton iteration to refine a single  
     80  This uses Newton iteration to refine a single point within a triangle. 
    8181 
    8282  coordT *point Composition coordinates of the starting point for refining; the 
     
    178178  int hullRefine It returns zero or an error code. 
    179179 
     180  ternary_point *points Point information. 
     181 
     182  int numpoints Number of points of which to calculate the convex hull. 
     183 
    180184  energy_params *eparams Collection of energy parameter structures. 
    181185 
     
    197201  ++++++++++++++++++++++++++++++++++++++*/ 
    198202 
    199 int hullRefine (energy_params *eparams, int nparams, double T, double P, 
    200                 double newton_tolerance, double vertex_tolerance, 
    201                 int one_phase_refine) 
     203int hullRefine 
     204(ternary_point *points, int npoints, energy_params *eparams, int nparams, 
     205 double T,double P, double newton_tolerance, double vertex_tolerance, 
     206 int one_phase_refine) 
    202207{ 
    203208  facetT *facet; 
     
    215220      double corners [9], centroid [3], Gcenter; 
    216221      vertexT *vertex, **vertexp; 
    217       int j=0, eparam [3] = {0,0,0}
     222      int j=0, eparam [3] = {0,0,0}, thepoint [3]
    218223 
    219224      /*+ 
     
    226231      FOREACHvertex_(facet->vertices) 
    227232        { 
    228           int thepoint = (vertex->point-qh first_point)/3; 
    229  
    230233          if (j<3) 
    231234            { 
    232               int i; 
    233               double emin; 
     235              thepoint [j] = (vertex->point-qh first_point)/3; 
    234236 
    235237              corners [3*j]   = vertex->point[0]; 
     
    237239              corners [3*j+2] = vertex->point[2]; 
    238240 
    239               emin = fabs (corners [3*j+2] - free_energy 
    240                            (corners [3*j], corners [3*j+1], T, P, eparams)); 
    241  
    242               for (i=1; i<nparams; i++) 
    243                 if (fabs (corners [3*j+2] - free_energy 
    244                           (corners [3*j], corners [3*j+1], T, P, eparams+i)) 
    245                     < emin) 
    246                   { 
    247                     emin = fabs (corners [3*j+2] - free_energy 
    248                                  (corners [3*j], corners [3*j+1], T, P, eparams+i)); 
    249                     eparam [j] = i; 
    250                   } 
    251               if (emin > 1.e-10) // Sanity check; this should always be zero 
    252                 printf ("Vertex at %g,%g: eparam=%d, emin=%g\n", 
    253                         corners [3*j], corners [3*j+1], eparam [j], emin); 
     241              eparam [j] = points[thepoint[j]].efunc; 
    254242            } 
    255243          j++; 
    256244        } 
    257245 
    258       // Ignore non-simplical facets and top facet 
     246      // Ignore non-simplical side facets and top facet 
    259247      if (fabs((corners[3]-corners[0])*(corners[7]-corners[1]) - 
    260248               (corners[6]-corners[0])*(corners[4]-corners[1])) < 0.999999 
     
    268256                  corners[0], corners[1], corners[3], 
    269257                  corners[4], corners[6], corners[7]); 
    270           printf ("  Curves: %d %d %d, Area: %g\n", 
     258          printf ("  Curves: %d %d %d, points %d %d %d, Area: %g\n", 
    271259                  eparam[0], eparam[1], eparam[2], 
     260                  thepoint[0], thepoint[1], thepoint[2], 
    272261                  fabs((corners[3]-corners[0])*(corners[7]-corners[1]) - 
    273262                       (corners[6]-corners[0])*(corners[4]-corners[1]))); 
     
    287276          Gcenter = free_energy (centroid[0], centroid[1], T, P, eparams); 
    288277          for (j=1; j<nparams; j++) 
    289             if (Gcenter > free_energy (centroid[0],centroid[1], T,P, eparams)) 
     278            if (Gcenter > free_energy (centroid[0],centroid[1], T,P, eparams+j)) 
    290279              { 
    291                 Gcenter = free_energy (centroid[0],centroid[1], T,P, eparams); 
     280                Gcenter = free_energy (centroid[0],centroid[1], T,P, eparams+j); 
    292281                eparamc = j; 
    293282              } 
  • trunk/matml/src/ternary/ternary.c

    r379 r381  
    7878    { printf ("main: Error %d in scale_triangle_array\n", i); exit (i); } 
    7979 
    80   /* Send points and triangle vertex data to Geomview */ 
     80  /* Send free energy surface data to Geomview */ 
    8181  if (i=GeomviewDisplayTriangleCOFF 
    8282      (pfd, "Ternary Free Energy", "tfe", "shading smooth", 
     
    8686  /* Calculate and refine the lower convex hull */ 
    8787  printf ("qhull version: %s\n", hullQHullVersion()); 
    88   if (i=hullCalculate (3, (loop_max+1)*(loop_max+2), points)) 
     88  if (i=hullCalculate (3, points, (loop_max+1)*(loop_max+2))) 
    8989    { printf ("main: Error %d in hullCalculate\n", i); exit (i); } 
    90   //if (i=hullRefine (allparams, 2, T, P, 1e-15, 1e-10, 0)) 
    91   //  { printf ("main: error %d in hullRefine\n", i); exit (i); } 
     90  if (i=hullRefine (points, (loop_max+1)*(loop_max+2), allparams, 2, T, P, 
     91                    1e-10, 1e-7, 0)) 
     92    { printf ("main: error %d in hullRefine\n", i); exit (i); } 
    9293  if (i=hullReturnFacets (&hullnumverts, &hullverts)) 
    9394    { printf ("main: Error %d in hullReturnFacets\n", i); exit (i); } 
  • trunk/matml/src/ternary/ternary.h

    r379 r381  
    119119 
    120120/* From qhull.c */ 
    121 int hullCalculate (int dim, int numpoints, ternary_point *points); 
    122 int hullRefine (energy_params *eparams, int nparams, double T, double P, 
    123                 double newton_tolerance, double vertex_tolerance, 
    124                 int one_phase_refine); 
     121int hullCalculate (int dim, ternary_point *points, int numpoints); 
     122int hullRefine 
     123(ternary_point *points, int numpoints, energy_params *eparams, int nparams, 
     124 double T,double P, double newton_tolerance, double vertex_tolerance, 
     125 int one_phase_refine); 
    125126int hullReturnFacets (int *facets, int **verts); 
    126127char *hullQHullVersion (); 




About | Terms of Use | Contact | Privacy Policy