<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML DIR=ltr><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"></HEAD><BODY>
<DIV id=idOWAReplyText77634 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=3>Hello everybody, I ha indeed
a problem with vtk binary file.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial color=#000000 size=3>I have tried to write a vtk
binary file in F77... I could not.. so I have tried to write it with C but I
cannot make paraview read what I am writing!</FONT></DIV>
<DIV dir=ltr><FONT face=Arial>This is the program I am using to outputting
a slice with a vtk format, I should be able to read it. The problem is that the
shape looks correct but the values are completely wrong!</FONT></DIV>
<DIV dir=ltr><FONT face=Arial>can you please suggest me something? So once it is
working I can try to reproduce exactly the same stuff in F77.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial>Cheers</FONT></DIV>
<DIV dir=ltr><FONT face=Arial>Alberto</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr>#include <stdio.h><BR>#include <string.h><BR>#include
<time.h><BR>#include <math.h></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr>main()<BR>{<BR> double
v[10];<BR> double
Pv[10];<BR> float
r[10];<BR> float
mat[10][10];<BR> double
matD[10][10];<BR> int
i,j;<BR> FILE
*fw;<BR> FILE
*fr;<BR> FILE
*VTK;<BR> FILE
*VTKD;<BR>
fw=fopen("output_BIN.dat","w");<BR>
VTK=fopen("output_VTK.vtk","w");<BR>
VTKD=fopen("output_VTK_double.vtk","w");</DIV>
<DIV dir=ltr> for (i=0;i<=5;i++)
v[i]=double(i)*1.0;<BR>
<BR> for (i=0;i<=5;i++)
Pv[i]=double(v[i]); <BR> for
(i=0;i<=5;i++)
fwrite(&Pv[i],sizeof(double),1,fw);<BR>
<BR> fclose(fw);<BR>
<BR> <BR>
//initialize the matrix<BR> for
(i=0;i<10;i++)<BR>
{<BR> for
(j=0;j<10;j++)<BR>
{<BR>
if(i<5 && j<5)
mat[i][j]=float(0.0);<BR>
if(i>4 && j<5)
mat[i][j]=float(10.0);<BR>
if(i<5 && j>4)
mat[i][j]=float(200.0);<BR>
if(i>4 && j>4)
mat[i][j]=float(500.0);<BR>
}<BR> }<BR>
<BR> //setting in the file the VTK
path<BR> fprintf(VTK,"# vtk DataFile Version
3.0\n");<BR> fprintf(VTK,"Structured Grid
Dataset\n");<BR>
fprintf(VTK,"BINARY\n");<BR> fprintf(VTK,"DATASET
STRUCTURED_POINTS\n");<BR> fprintf(VTK,"DIMENSIONS
1 10 10\n");<BR> fprintf(VTK,"ORIGIN 0 0
0\n");<BR> fprintf(VTK,"SPACING 1 1.3333E-3
1.3333E-3\n");<BR> fprintf(VTK,"POINT_DATA
100\n");<BR> fprintf(VTK,"SCALARS Density
float\n");<BR> fprintf(VTK,"LOOKUP_TABLE
default\n");<BR> <BR>
<BR> for
(i=0;i<10;i++)<BR>
{<BR> for
(j=0;j<10;j++)<BR>
{<BR>
fwrite(&mat[i][j],sizeof(float),1,VTK);<BR>
}<BR> } <BR>
fclose(VTK);<BR> <BR> <BR>}<BR></DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV></DIV>
<DIV id=idSignature13437 dir=ltr>
<DIV><FONT face=Arial color=#000000
size=2>==============================<BR>Marocchino Alberto</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000000 size=2>PhD / Research Assistant</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000000 size=2>Plasma Physics Group, <BR>Blackett
Laboratory, <BR>Imperial College, <BR>Prince Consort Road, <BR>London, SW7 2BW,
U.K.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial color=#000000 size=2>tel. 44 20 7594 7649 <BR>fax. 44 20
7594 7658 <BR>Skype coyote_from_los_alamos</FONT></DIV></DIV></BODY></HTML>