Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b589b872 authored by FELŠÖCI Marek's avatar FELŠÖCI Marek
Browse files

Remove options for writing mesh into a file

parent aaeae18a
Branches
Tags
No related merge requests found
...@@ -45,12 +45,6 @@ extern ScalarType stype; ...@@ -45,12 +45,6 @@ extern ScalarType stype;
/*! \brief Wavelength (for oscillatory kernels). */ /*! \brief Wavelength (for oscillatory kernels). */
extern double lambda; 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. */ /*! \brief List of algorithms that we can test. */
enum algo { enum algo {
_undefined, _undefined,
......
...@@ -69,125 +69,6 @@ double* createCylinder(void) { ...@@ -69,125 +69,6 @@ double* createCylinder(void) {
ierr=computeCoordCylinder(i, &(result[(size_t)3*i]) ) ; CHKERRA(ierr) ; 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; return result;
} }
......
...@@ -19,8 +19,6 @@ int simplePrec = 0; ...@@ -19,8 +19,6 @@ int simplePrec = 0;
int complexALGO = 1; int complexALGO = 1;
ScalarType stype = DOUBLE_COMPLEX; ScalarType stype = DOUBLE_COMPLEX;
double lambda; double lambda;
int writeMesh = 0;
int writeMeshUNV = 0;
enum algo testedAlgo = _undefined; enum algo testedAlgo = _undefined;
int use_simple_assembly = 0; int use_simple_assembly = 0;
int divider = 2; int divider = 2;
...@@ -102,17 +100,6 @@ int main(int argc, char **argv) { ...@@ -102,17 +100,6 @@ int main(int argc, char **argv) {
printf("Reading nbPts = %d\n", nbPts) ; 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) ; ierr=initCylinder(&argc, &argv) ; CHKERRQ(ierr) ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment