/* * (C) COPYRIGHT International Business Machines Corp. 1994 * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of IBM not be * used in advertising or publicity pertaining to distribution of the * software without specific prior written permission. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include int isfound(int *buffer, int *indices, int nindices, int *values, int nvalues) { int i, j; for (i = 0; i < nindices; ++i) { for (j = 0; j < nvalues; ++j) { if (buffer[indices[i]] == values[j]) return 1; } } return 0; } main(int argc, char *argv[]) { char *basefile; char *unvfile; char *allfiles; char text[500]; char *found, **speciesnames = NULL; char s[2], speciesname[500]; int axisym, index, numi, numj, numk, i, j, k; int neighbor[8]; int celli, cellj, cellk; int celltype, celltypenumber; int numdim=0, xyz, uvw, vdim; int line; int nspecies=0; int speciescount=0; int eflag=0, tflag=0, pflag=0, sflag=0, evflag=0, vflag=0, dflag=0; int tcflag=0, shflag=0, tkflag=0, teflag=0; float datavalue; float *positionbuffer; int *cellbuffer; int invalids[1]; int ninvalids = 0; int inlets[64]; int ninlets = 0; int nactct = 0; FILE *input; if(argc != 2){ printf("Usage: %s fluent_universal_file_name \n",argv[0]); exit(1); } allfiles = (char *)malloc(strlen(argv[argc-1])+50); basefile = (char *)malloc(strlen(argv[argc-1])+50); unvfile = (char *)malloc(strlen(argv[argc-1])+50); strcpy(unvfile,argv[argc - 1]); input = fopen(unvfile,"r"); if (input == NULL){ perror(unvfile); exit(1); } while (fgets(text, 500, input) != NULL){ found = strstr(text, "GRID SIZE"); if (found){ fgets(text, 500, input); sscanf(text, "%d %d %d %d", &celli, &cellj, &cellk, &axisym); numi = celli - 1; numj = cellj - 1; if(cellk==1) numk=1; else numk = cellk-1; if(numk>1){ numdim=3; printf("Object \"connectionsarray\" class gridconnections" " counts %d %d %d\n", numi, numj, numk); printf("attribute \"element type\" string \"cubes\"\n"); } else{ numdim=2; printf("Object \"connectionsarray\" class gridconnections" " counts %d %d \n", numi, numj); printf("attribute \"element type\" string \"quads\"\n"); } printf("attribute \"ref\" string \"positions\"\n"); } found = strstr(text, "CELL TYPE TABLE"); if (found){ fgets(text, 500, input); sscanf(text, "%d", &nactct); for (i=0; i