diff --git a/include/main.h b/include/main.h index 6cc2b0e40df365e33917030a91855d02d77ce51b..3cc290fc4c7979a5f6c8367d203d576c8bd37633 100644 --- a/include/main.h +++ b/include/main.h @@ -45,12 +45,6 @@ extern ScalarType stype; /*! \brief Wavelength (for oscillatory kernels). */ extern double lambda; -/*! \brief Write a VTK file of the mesh. Enabled with option --write-mesh. */ -extern int writeMesh; - -/*! \brief Write a UNV file of the mesh. Enabled with option --write-mesh-unv. */ -extern int writeMeshUNV; - /*! \brief List of algorithms that we can test. */ enum algo { _undefined, diff --git a/src/cylinder.c b/src/cylinder.c index 307405dddaf4d5624b24d4243bb98b4fbe4abf44..b95e9d539ee8b3302d408963f785b3a3bc1fc36f 100644 --- a/src/cylinder.c +++ b/src/cylinder.c @@ -69,125 +69,6 @@ double* createCylinder(void) { ierr=computeCoordCylinder(i, &(result[(size_t)3*i]) ) ; CHKERRA(ierr) ; } - if (writeMesh) { - FILE *fvtk=fopen("mesh.vtu", "w"); - // VTK Header - fprintf(fvtk, "<?xml version=\"1.0\"?>\n"); - fprintf(fvtk, "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" " - "byte_order=\"LittleEndian\" compressor=\"vtkZLibDataCompressor\">\n"); - fprintf(fvtk, "\t<UnstructuredGrid>\n"); - - ASSERTA(nbPts-nbPtsLoop-1 < INT_MAX/2); - int nbTria = 2*(nbPts-nbPtsLoop-1); - fprintf(fvtk, "\t\t<Piece NumberOfPoints=\"%d\" NumberOfCells=\"%d\">\n", nbPts, nbTria); - // Write the vertices - fprintf(fvtk, "\t\t\t<Points>\n"); - fprintf(fvtk, "\t\t\t\t<DataArray type=\"Float32\"" - " NumberOfComponents=\"3\" format=\"ascii\">\n"); - double* coord=result; - for (int iVtk = 0; iVtk < nbPts; iVtk++, coord+=3) { - fprintf(fvtk, "%g %g %g\n", (float) (coord[0]), (float)(coord[1]), (float)(coord[2])); - } - fprintf(fvtk, "\t\t\t\t</DataArray>\n"); - fprintf(fvtk, "\t\t\t</Points>\n"); - // VTK Elements - fprintf(fvtk, "\t\t\t<Cells>\n"); - fprintf(fvtk, "\t\t\t\t<DataArray " - "type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n"); - /* Loop on the triangles (main cylinder) */ - for (int iVtk = 0; iVtk+nbPtsLoop+1 < nbPts; iVtk++) { - // 1st triangle - fprintf(fvtk, "%d %d %d\n", iVtk, iVtk+1, iVtk+nbPtsLoop); - // 2nd Triangle - fprintf(fvtk, "%d %d %d\n", iVtk+1, iVtk+nbPtsLoop, iVtk+nbPtsLoop+1); - } - fprintf(fvtk, "\t\t\t\t</DataArray>\n"); - - /* Ecriture des offsets */ - fprintf(fvtk, "\t\t\t\t<DataArray " - "type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n"); - for (int iVtk = 0; iVtk < nbTria; iVtk++) { - fprintf(fvtk, "%d ", iVtk*3+3); - if (iVtk % 10 == 9) - fprintf(fvtk, "\n"); - } - fprintf(fvtk, "\t\t\t\t</DataArray>\n"); - - /* Ecriture des types d'elements */ - fprintf(fvtk, "\t\t\t\t<DataArray " - "type=\"UInt8\" Name=\"types\" format=\"ascii\">\n"); - for (int iVtk = 0; iVtk < nbTria; iVtk++) { - fprintf(fvtk, "%d ", 5); // For VTK_TRIANGLE - if (iVtk % 10 == 9) - fprintf(fvtk, "\n"); - } - fprintf(fvtk, "\t\t\t\t</DataArray>\n"); - fprintf(fvtk, "\t\t\t</Cells>\n"); - fprintf(fvtk, "\t\t</Piece>\n\t</UnstructuredGrid>\n</VTKFile>\n"); - fclose(fvtk); - printf("Done writing 'mesh.vtu'\n") ; - } - - if (writeMeshUNV) { -#define sNODE_UNV_ID " 2411" -#define sELT_UNV_ID " 2412" -#define sGRP_UNV_ID " 2435" -#define sUNV_SEPARATOR " -1" -#define sNODE_UNV_DESCR " 1 1 11" -#define sELT_TRIA3_DESC " 91 1 1 5 3" -#define sELT_TETRA4_DESC " 111 1 2 9 4" - printf("Writing 'mesh.unv'... ") ; - - FILE *funv=fopen("mesh.unv", "w"); - /* -------- */ - /* Vertices */ - /* -------- */ - fprintf(funv, "%s\n",sUNV_SEPARATOR ) ; - fprintf(funv, "%s\n", sNODE_UNV_ID ); - double* coord=result; - for( i = 1; i<=nbPts; i++, coord+=3 ) { - fprintf(funv, "%10d%s\n", i, sNODE_UNV_DESCR ); - fprintf(funv, "%25.16E%25.16E%25.16E\n", coord[0], coord[1], coord[2]) ; - } - fprintf(funv, "%s\n",sUNV_SEPARATOR ) ; - /* -------- */ - /* Elements */ - /* -------- */ - fprintf(funv, "%s\n",sUNV_SEPARATOR ) ; - fprintf(funv, "%s\n", sELT_UNV_ID ); - int nbTria=0; - /* Loop on the triangles (main cylinder) */ - for (int iVtk = 1; iVtk+nbPtsLoop+1 <= nbPts; iVtk++) { - // 1st triangle - fprintf(funv, "%10d%s\n", ++nbTria, sELT_TRIA3_DESC ) ; - fprintf(funv, "%10d%10d%10d\n", iVtk, iVtk+1, iVtk+nbPtsLoop) ; - // 2nd Triangle - fprintf(funv, "%10d%s\n", ++nbTria, sELT_TRIA3_DESC ) ; - fprintf(funv, "%10d%10d%10d\n", iVtk+1, iVtk+nbPtsLoop, iVtk+nbPtsLoop+1); - } - fprintf(funv, "%s\n",sUNV_SEPARATOR ) ; - /* ------ */ - /* Groups */ - /* ------ */ - fprintf(funv, "%s\n",sUNV_SEPARATOR ) ; - fprintf(funv, "%s\n", sGRP_UNV_ID ); - /* Group C_EXT for all the triangles */ - fprintf(funv, "%10d%10d%10d%10d%10d%10d%10d%10d\n", 1, 0, 0, 0, 0, 0, 0, nbTria) ; - fprintf(funv, "C_EXT\n") ; - for (i=1 ; i<=nbTria ; i++) { - fprintf(funv, "%10d%10d%10d%10d", 8, i, 0, 0) ; - if ( (i%2==0) || (i==nbTria) ) - fprintf(funv, "\n") ; - } - fprintf(funv, "%s\n",sUNV_SEPARATOR ) ; - fclose(funv); - printf("Done.\n") ; - } - - // In case we pass a second time in this routine - writeMesh = 0; - writeMeshUNV = 0; - return result; } diff --git a/src/main.c b/src/main.c index de882d38985adf82be56b7c6d532df101d4a96bb..37d3c6a32b21cd7971676f6a1428defeff6f98c9 100644 --- a/src/main.c +++ b/src/main.c @@ -19,8 +19,6 @@ int simplePrec = 0; int complexALGO = 1; ScalarType stype = DOUBLE_COMPLEX; double lambda; -int writeMesh = 0; -int writeMeshUNV = 0; enum algo testedAlgo = _undefined; int use_simple_assembly = 0; int divider = 2; @@ -102,17 +100,6 @@ int main(int argc, char **argv) { printf("Reading nbPts = %d\n", nbPts) ; } - /* --- Write a VTK file 'mesh.vtu' of the mesh --- */ - if (MpfArgHasName(&argc, argv, 1, "--write-mesh")) { - writeMesh=1; - printf("Activate writing of VTK file 'mesh.vtu'\n") ; - } - /* --- Write a UNV file 'mesh.unv' of the mesh --- */ - if (MpfArgHasName(&argc, argv, 1, "--write-mesh-unv")) { - writeMeshUNV=1; - printf("Activate writing of UNV file 'mesh.unv'\n") ; - } - ierr=initCylinder(&argc, &argv) ; CHKERRQ(ierr) ;