/*-------------------------------------------------------------------------78-- * Program to read in 3D finite element data from ViTLES simulations * and generate output files in VTK format. * * *** Coarse Linear Element Version *** * * This version creates 4 noded linear elements (vtk type=10) from each * quadratic element. * * The VTK format includes: * vitles_root.vtk (coordinate, connectivity and solution) ----------------------------------------------------------------------------*/ # include # include # include int main ( int argc, char *argv[] ) { // variables for file names FILE *in_vitles; // file used to read ViTLES file (to get problem sizes) FILE *in_vitlesx; // file used to read ViTLES geometry FILE *in_vitlesu; // file used to read ViTLES solution FILE *out_vtk; // file used to write VTK file // variables for filenames char vitles_file[255], geometry_file[255], solution_file[255], vtk_file[255] ; // input arguments char vitles_root[255]; int time_iteration; // counters int e_counter, e, i, j, n, nz; // mesh dimensions int n_elems , n_nodes , n_zones ; // "pointers" int local_node , n_zone_unknowns ; int n_dir , n_elzone , n_equations ; // fscan temporary variables char temp[128]; double D[11]; int I[11]; // allocatables int *e_conn; double *x; double *u; double *v; double *w; double *p; /*-------------------------------------------------------------------------*/ /* Open ViTLES geometry and data files */ /*-------------------------------------------------------------------------*/ if (argc !=3) { printf("\n%s%s%s\n\n", "Usage: ", argv[0], " ViTLES_rootname time_snapshot_number"); exit(1); } strcpy(vitles_root,argv[1]); time_iteration = atoi(argv[2]); printf("reading solution from time snapshot: %4d\n",time_iteration); // get problem size from the vitles_root.vitles file... sprintf(vitles_file,"%s.vitles",vitles_root); in_vitles = fopen(vitles_file,"r"); if ( in_vitles==NULL ) { printf("Can't open file %s to get problem size information",vitles_file); exit(1); } fgets(temp,128,in_vitles); fscanf(in_vitles,"%d %d %d \n",&I[0],&I[1],&I[2]); n_nodes = I[0]; n_zones = I[2]; e_counter = 0; // element counter /*--------------------------------------------------------------------------*/ // get total number of elements /*--------------------------------------------------------------------------*/ n_elems = 0; for (nz=0; nz