Changeset 423 for trunk/matml

Show
Ignore:
Timestamp:
02/23/2009 06:47:29 PM (3 years ago)
Author:
powell
Message:

New GeomviewDisplayFacets? function, pretty self-explanatory.

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

Legend:

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

    r422 r423  
    114114 
    115115/*++++++++++++++++++++++++++++++++++++++ 
     116  This sends a bunch of facet objects to Geomview in COFF format. 
     117 
     118  int GeomviewDisplayFacets It returns zero or an error code. 
     119 
     120  FILE *geompipe FILE pointer hooked to Geomview stdin. 
     121 
     122  char *name Full name of this Geomview object. 
     123 
     124  char *label Short label of this Geomview object. 
     125 
     126  char *appearance Appearance tag for this Geomview object. 
     127 
     128  int npoints Number of points. 
     129 
     130  ternary_point *points Point coordinates and colors. 
     131 
     132  int numfacets Number of facet objects to display. 
     133 
     134  hull_facet *facets Array of facet objects. 
     135 
     136  facet_type type Facet type to display, or ALL_TYPES to display all of them. 
     137  ++++++++++++++++++++++++++++++++++++++*/ 
     138 
     139int GeomviewDisplayFacets 
     140(FILE *geompipe, char *name, char *label, char *appearance, 
     141 int npoints, ternary_point *points, int numfacets, hull_facet *facets, 
     142 facet_type type) 
     143{ 
     144  int i, n=0; 
     145 
     146  // Count number of relevant facets 
     147  if (type == ALL_TYPES) 
     148    n = numfacets; 
     149  else 
     150    for (i=0; i<numfacets; i++) 
     151      if (facets [i].type == type) 
     152        n++; 
     153 
     154  fprintf (geompipe, "(geometry \"%s\" { : %s })\n", name, label); 
     155  fprintf (geompipe, "(read geometry { define %s \n", label); 
     156  fprintf (geompipe, "appearance { %s }\nCOFF\n", appearance); 
     157  fprintf (geompipe, "%d %d 0\n", npoints, n); 
     158 
     159  for (i=0; i<npoints; i++) 
     160    fprintf (geompipe, "%g %g %g %g %g %g %g\n", points[i].x, points[i].y, 
     161             points[i].z, points[i].red, points[i].green, points[i].blue, 
     162             points[i].alpha); 
     163 
     164  for (i=0; i<numfacets; i++) 
     165    if (type == ALL_TYPES || type == facets[i].type) 
     166      fprintf (geompipe, "3 %d %d %d\n", facets[i].vertex[0], facets[i].vertex[1], facets[i].vertex[2]); 
     167 
     168  fprintf (geompipe, "})\n"); 
     169  fflush (geompipe); 
     170 
     171  return 0; 
     172} 
     173 
     174 
     175/*++++++++++++++++++++++++++++++++++++++ 
    116176  Displays a phase boundary.  Note this pipes all of the points back to 
    117177  geomview again. 
  • trunk/matml/src/ternary/ternary.c

    r421 r423  
    111111    { printf ("main: error %d in hullRefine\n", i); exit (i); }*/ 
    112112 
    113   /* Take out hull triangles which are on the main function (in one phase) */ 
    114   /*for (i=0; i<hullnumfacets; i++) 
    115     { 
    116  
    117       // Remove one-phase facets to display just binodal and ternary 
    118       if (hullfacets [i].type == ONE_PHASE) 
    119         { 
    120           for (j=i; j<hullnumfacets-1; j++) 
    121             hullfacets [j] = hullfacets [j+1]; 
    122           hullnumfacets--; 
    123           i--; 
    124         } 
    125     } */ 
    126  
    127   printf ("Binodal region has %d facets\n", hullnumfacets); 
    128  
    129113  if (i=scale_energy_array (numpoints, points, 0., -.2, 1., .9, NULL, NULL)) 
    130114    { printf ("main: Error %d in scale_triangle_array\n", i); exit (i); } 
     115 
     116  if (i=GeomviewDisplayFacets 
     117      (pfd, "Binodal and Tie Lines", "ech", "-face +edge", 
     118       numpoints, points, hullnumfacets, hullfacets, TWO_PHASE)) 
     119    { printf ("main: Error %d in Geomview Display\n", i); exit (i); } 
    131120 
    132121  printf ("Press <return> to close up... "); 
  • trunk/matml/src/ternary/ternary.h

    r421 r423  
    157157(FILE *geompipe, char *name, char *label, char *appearance, 
    158158 int npoints, ternary_point *points, int ntriangles, int *vertices); 
     159int GeomviewDisplayFacets 
     160(FILE *geompipe, char *name, char *label, char *appearance, 
     161 int npoints, ternary_point *points, int numfacets, hull_facet *facets, 
     162 facet_type type); 
    159163int GeomviewDisplayPhaseBoundary 
    160164(FILE *geompipe, char *name, char *label, char *appearance,