<!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&nbsp;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>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr>#include &lt;stdio.h&gt;<BR>#include &lt;string.h&gt;<BR>#include 
&lt;time.h&gt;<BR>#include &lt;math.h&gt;</DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr>main()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double 
v[10];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double 
Pv[10];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float 
r[10];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float 
mat[10][10];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double 
matD[10][10];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int 
i,j;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILE 
*fw;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILE 
*fr;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILE 
*VTK;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILE 
*VTKD;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fw=fopen("output_BIN.dat","w");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
VTK=fopen("output_VTK.vtk","w");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
VTKD=fopen("output_VTK_double.vtk","w");</DIV>
<DIV dir=ltr>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (i=0;i&lt;=5;i++) 
v[i]=double(i)*1.0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (i=0;i&lt;=5;i++) 
Pv[i]=double(v[i]);&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for 
(i=0;i&lt;=5;i++) 
fwrite(&amp;Pv[i],sizeof(double),1,fw);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fclose(fw);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//initialize the matrix<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for 
(i=0;i&lt;10;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for 
(j=0;j&lt;10;j++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if(i&lt;5 &amp;&amp; j&lt;5) 
mat[i][j]=float(0.0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if(i&gt;4 &amp;&amp; j&lt;5) 
mat[i][j]=float(10.0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if(i&lt;5 &amp;&amp; j&gt;4) 
mat[i][j]=float(200.0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if(i&gt;4 &amp;&amp; j&gt;4) 
mat[i][j]=float(500.0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //setting in the file the VTK 
path<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"# vtk DataFile Version 
3.0\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"Structured Grid 
Dataset\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fprintf(VTK,"BINARY\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"DATASET 
STRUCTURED_POINTS\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"DIMENSIONS 
1 10 10\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"ORIGIN 0 0 
0\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"SPACING 1 1.3333E-3 
1.3333E-3\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"POINT_DATA 
100\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"SCALARS Density 
float\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(VTK,"LOOKUP_TABLE 
default\n");<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for 
(i=0;i&lt;10;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for 
(j=0;j&lt;10;j++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fwrite(&amp;mat[i][j],sizeof(float),1,VTK);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fclose(VTK);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>}<BR></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=Arial color=#000000 size=2>PhD / Research Assistant</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</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>