CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   ParaView (http://www.cfd-online.com/Forums/paraview/)
-   -   PARAVIEW Grid visualization (http://www.cfd-online.com/Forums/paraview/12859-paraview-grid-visualization.html)

simone Marras January 23, 2007 08:15

PARAVIEW Grid visualization
 
Hello, Im struggling in having paraview read my structure grid file. I tried towrite it as a DATASET RECTILINEAR_GRID and DATASET STRUCTURED_GRID with the routines here below, but when i open the data from paraview it says it doesn't have a reader for them and doesn't view anything. Can anyone help me by sending me his file format as a txt file so that Ill write mine with that same structure?

Thank you very much s.

1) "DATASET RECTILINEAR_GRID"

/* File grid.vts */

if((xy_grid = fopen("grid.vts", "w")) == NULL)

printf("The grid file could not be open\n");

else{

fprintf(xy_grid, "# vtk DataFile Version 2.0\n");

fprintf(xy_grid, "Grid\n");

fprintf(xy_grid, "ASCII\n");

fprintf(xy_grid, "\n");

fprintf(xy_grid, "DATASET RECTILINEAR_GRID\n");

fprintf(xy_grid, "DIMENSIONS %d %d\n", nx, ny, nz);

fprintf(xy_grid, "X_COORDINATES %d float\n", nx);

for(i=0; i<=nx-1; i++)

fprintf(xy_grid, "%f\t", x[i]);

fprintf(xy_grid, "\n Y_COORDINATES %d float\n", ny);

for(j=0; j<=ny-1; j++)

fprintf(xy_grid, "%f\t", y[j]);

fprintf(xy_grid, "\n Z_COORDINATES %d float\n", nz);

fprintf(xy_grid, "%f\t", z);

fprintf(xy_grid, "\n");

}

fclose(xy_grid);

2)"DATASET STRUCTURED_GRID"

/* File grid_m.dat for Octave visulaization *

wrt_fmat(imax*jmax-1, 0, "grid.msh", mesh);*/

/* File grid.vts *

//if((xy_grid = fopen(file_grid_name, "w")) == NULL)

if((xy_grid = fopen("grid.vts", "w")) == NULL)

printf("The grid file could not be open\n");

else{

fprintf(xy_grid, "# vtk DataFile Version 2.0\n");

fprintf(xy_grid, "Grid\n");

fprintf(xy_grid, "ASCII\n");

fprintf(xy_grid, "\n");

fprintf(xy_grid, "DATASET STRUCTURED_GRID\n");

fprintf(xy_grid, "DIMENSIONS %d %d\n", nx, ny, nz);

fprintf(xy_grid, "POINTS %d\n float", n);

//fprintf(xy_grid, "ORIGIN 0.000 0.000 0.000\n");

//fprintf(xy_grid, "SPACING 1.000 1.000 0.000\n");

fprintf(xy_grid, "\n");

///fprintf(xy_grid, "POINT_DATA %d\n", nx*ny*nz);

f//printf(xy_grid, "VECTORS vectors float\n");

//fprintf(xy_grid, "\n");*

for(i=0; i<=imax*jmax; i++)

for(j=0; j<=2; j++){

fprintf(xy_grid, "%.4f ", mesh[i][j]);

fprintf(xy_grid, " \n");

}

}

fclose(xy_grid);*/


Renato. January 23, 2007 09:03

Re: PARAVIEW Grid visualization
 
I hate the VTK's formats and in my case I chose the Ensight format to write my files. It's very simple to understand and implement and ParaView is able to read it.

I've put some Fortran routines to write Ensight files available at http://www.nacad.ufrj.br/~rnelias/paraview

Cheers

Renato.


simone Marras January 23, 2007 09:05

Re: PARAVIEW Grid visualization
 
Thank you very much renato, Ill follow your suggestions!

simone


All times are GMT -4. The time now is 03:15.