Dear All
I am new to ParaView. I need to write binary files from my C code for viz with
ParaView. So far, I assign values to a M x N 2D array, and write legacy VTK
files - that works fine. I used code as pasted below to see if I can get the
binary output (which uses a simple fwrite) working, but was unable to viz the
data in the binary output. Can someone suggest how to write ParaView raw binary
files (hopefully with minimal headers), and how to viz them interactively using
the GUI.
thanks
Sanjay
relevant code part:
// write to file
if (fcnt == 40) {
// Legacy VTK format: this works fine.
str = malloc (64*sizeof(char));
sprintf (str, "fhn_2d_%d.vtk", cnt++);
out1 = fopen (str, "wt");
free(str);
fprintf(out1, "# vtk DataFile Version 3.0\n");
fprintf(out1, "vtk output\n");
fprintf(out1, "ASCII\n");
fprintf(out1, "DATASET STRUCTURED_POINTS\n");
fprintf(out1, "DIMENSIONS %d %d 1\n",N+1,M+1); // N+1 columns,
M+1+header rows
fprintf(out1, "SPACING 1 1 1\n");
fprintf(out1, "ORIGIN 0 0 0\n");
fprintf(out1, "POINT_DATA %d\n",(N+1)*(M+1)); // total number of points
on structured data.
fprintf(out1, "SCALARS ImageFile float 1\n");
fprintf(out1, "LOOKUP_TABLE default\n");
for (m = 0; m <= M; m++) {
for (n = 0; n <= N; n++)
fprintf (out1, "%6.4f ", u[n][m]);
fprintf (out1, "\n");
}
fclose (out1);
// binary output of the same data. Limited understanding of what
ParaView wants.
str = malloc(64*sizeof(char));
sprintf(str,"fhn2d%d.bin",cnt);
out1 = fopen(str,"wb");
free(str);
fwrite(u,sizeof(float),(N+1)*(M+1),out1);
fclose(out1);
fcnt = 0;
}
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview