/* test_pde_read_ucd.c reads pde_ucd.inp files */ #include #include #define _MAIN_ #include "pde_read_ucd.h" /* defines all variables and arrays */ /* all subscripts start with 1 */ /* vert struct {double x; double y; double z;} */ /* cell struct {int i; int matl; int ctyp; int v[9];} */ int main(int argc, char * argv[]) { int i, j, k; int ctypn[9] = { 0, 1, 2, 3, 4, 4, 5, 6, 8}; printf("test_pde_read_ucd.c running\n"); if(argc==2) pde_read_ucd(argv[1]); else pde_read_ucd("pde_ucd1.inp"); printf("pde_read_ucd returned:\n"); printf("1 based indexing\n"); printf("n_vertices (boundary)= %d \n",n_vertices); printf("n_cells (boundary faces)= %d \n",n_cells); printf("n_ndata (Dirichlet at vertices,4th,5th,6th coord)= %d \n",n_ndata); printf("n_cdata (Neumann outward from face, positive)= %d \n",n_cdata); printf("n_mdata (4th coordinate of vertices for 4D)= %d \n",n_mdata); printf("\n"); printf("boundary vertices:\n"); for(i=1; i<=n_vertices; i++) { printf("%d x=%f, y=%f, z=%f \n",i, vert[i].x, vert[i].y, vert[i].z); } printf("\n"); printf("boundary cells:\n"); for(i=1; i<=n_cells; i++) { printf("%d matl=%d, type=%d ", cell[i].i, cell[i].matl, cell[i].ctyp); k = ctypn[cell[i].ctyp]; for(j=1; j<=k; j++) printf("%d ", cell[i].v[j]); printf("\n"); } printf("\n"); if(n_ndata==1) { printf("Dirichlet boundary:\n"); printf("%s", nodes1); for(i=1; i<=n_vertices; i++) { printf("%d %f\n", i, dirichlet_bound[i]); } printf("\n"); } else if(n_ndata==2) { printf("Dirichlet boundary and fourth dimension:\n"); printf("%s", nodes1); printf("%s", nodes2); for(i=1; i<=n_vertices; i++) { printf("%d %f %f \n", i, d4th[i].dirichlet, d4th[i].fourth); } printf("\n"); } else if(n_ndata==3) { printf("Dirichlet boundary and 4th, 5th dimension:\n"); printf("%s", nodes1); printf("%s", nodes2); printf("%s", nodes3); for(i=1; i<=n_vertices; i++) { printf("%d %f %f %f \n", i, d4th[i].dirichlet, d4th[i].fourth, d4th[i].fifth); } printf("\n"); } else if(n_ndata==4) { printf("Dirichlet boundary and 4th, 5th, 6th dimension:\n"); printf("%s", nodes1); printf("%s", nodes2); printf("%s", nodes3); printf("%s", nodes4); for(i=1; i<=n_vertices; i++) { printf("%d %f %f %f %f \n", i, d4th[i].dirichlet, d4th[i].fourth, d4th[i].fifth, d4th[i].sixth); } printf("\n"); } if(n_cdata>0) { printf("Neumann boundary:\n"); printf("%s", cells1); for(i=1; i<=n_cells; i++) { printf("%d %f\n", i, neumann_bound[i]); } printf("\n"); } if(n_mdata>0) { printf("fourth coordinate of vertex:\n"); for(i=1; i<=n_vertices; i++) { printf("%d %f\n",i , fourth_dim[i]); } } printf("\n"); return 0; } /* end test_pde_read_ucd.c */