<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16447"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=954043910-30072012><FONT color=#0000ff
size=2 face=Arial>I am new to this part of ParaView sorry - the approach I took
was to use read the data and use VTK for writing the files - you can start with
the VTK examples and then plug in your values. There could be bugs so start
small and grow the problem size. I also found that including the rendering from
the VTK examples made things quicker as you could write/read and test in the
same code.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=954043910-30072012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=954043910-30072012><FONT color=#0000ff
size=2 face=Arial>Paul</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> krysl.petr@gmail.com
[mailto:krysl.petr@gmail.com] <B>On Behalf Of </B>Petr Krysl<BR><B>Sent:</B>
Monday, 30 July 2012 2:49 PM<BR><B>To:</B> Paul McIntosh<BR><B>Cc:</B>
paraview@paraview.org<BR><B>Subject:</B> Re: [Paraview] Do anyone have examples
of writing binary file with mesh and results data?<BR></FONT><BR></DIV>
<DIV></DIV>Paul,
<DIV><BR></DIV>
<DIV>This is a good guess. I have played with this already and Paraview would
read the points okay (for big ended write), but it would crash when reading the
cell data:</DIV>
<DIV><BR></DIV>
<DIV>…</DIV>
<DIV>
<DIV>for k=1:length(Connectivity)</DIV>
<DIV> f=Connectivity{k};</DIV>
<DIV> ctype=zeros(size(f, 1),1)+Cell_types{k};</DIV>
<DIV> fprintf(fid,'CELLS %d
%d\n',size(f,1),(size(f,1)*(size(f,2)+1)));%</DIV>
<DIV> if (~binary)</DIV>
<DIV> for i= 1:size(f, 1)</DIV>
<DIV> fprintf(fid,'%d
',size(f,2));</DIV>
<DIV> for j= 1:
size(f,2)</DIV>
<DIV>
fprintf(fid,'%d ',f(i,j)-1);</DIV>
<DIV> end</DIV>
<DIV>
fprintf(fid,'\n');</DIV>
<DIV> end</DIV>
<DIV> else</DIV>
<DIV>
fwrite(fid,cast([zeros(size(f,1),1)+size(f,2),f-1],'int32'),'int32','b');</DIV>
<DIV> end</DIV>
<DIV> fprintf(fid,'\n');</DIV>
<DIV> fprintf(fid,'\n');</DIV>
<DIV> fprintf(fid,'CELL_TYPES
%d\n',size(f,1));%</DIV>
<DIV> if (~binary)</DIV>
<DIV> for i= 1:size(f, 1)</DIV>
<DIV>
fprintf(fid,'%d\n',ctype(i));</DIV>
<DIV> end</DIV>
<DIV> else</DIV>
<DIV>
fwrite(fid,cast(ctype,'int32'),'int32','b');</DIV>
<DIV> end</DIV>
<DIV> fprintf(fid,'\n');</DIV>
<DIV> fprintf(fid,'\n');</DIV>
<DIV> end</DIV>
<DIV>…</DIV>
<DIV><BR></DIV>
<DIV>There is something wrong in the code above (or there's a bug in paraview).
By the way my Matlab code that writes out binary *structured_grid* data
works just fine with paraview.</DIV>
<DIV>It is just the unstructured grid that's giving me headaches.</DIV>
<DIV><BR></DIV>
<DIV>Petr</DIV><BR>
<DIV class=gmail_quote>On Sun, Jul 29, 2012 at 8:29 PM, Paul McIntosh <SPAN
dir=ltr><<A href="mailto:paul.mcintosh@internetscooter.com"
target=_blank>paul.mcintosh@internetscooter.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><U></U>
<DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff face=Arial>Maybe
c</FONT></SPAN><SPAN><FONT color=#0000ff face=Arial>heck the endianess - to
read a binary file that was generated in MATLAB I had to change the endianess.
I think there is a VTK util on the MATHWORKS site but I haven't tried
that.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff
face=Arial>Paul</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us align=left>
<HR>
<FONT face=Tahoma><B>From:</B> <A href="mailto:paraview-bounces@paraview.org"
target=_blank>paraview-bounces@paraview.org</A> [mailto:<A
href="mailto:paraview-bounces@paraview.org"
target=_blank>paraview-bounces@paraview.org</A>] <B>On Behalf Of </B>Petr
Krysl<BR><B>Sent:</B> Saturday, 28 July 2012 1:37 AM<BR><B>To:</B> <A
href="mailto:paraview@paraview.org"
target=_blank>paraview@paraview.org</A><BR><B>Subject:</B> Re: [Paraview] Do
anyone have examples of writing binary file with mesh and results
data?<BR></FONT><BR></DIV>
<DIV>
<DIV class=h5>
<DIV></DIV>Hi,
<DIV><BR></DIV>
<DIV>Did you ever get the Matlab writing of the binary VTK files to work?
I'm having problems with them too: PV crashes when reading the binary
files.<BR clear=all>
<DIV><BR></DIV>
<DIV>Thanks,</DIV>-- <BR>Petr Krysl
<DIV>University of California, San Diego</DIV>
<DIV>Skype: <A href="http://Petr.Krysl.UCSD.EDU"
target=_blank>Petr.Krysl.UCSD.EDU</A></DIV>
<DIV><A href="http://hogwarts.ucsd.edu/~pkrysl/"
target=_blank>http://hogwarts.ucsd.edu/~pkrysl/</A></DIV><BR></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV><BR><BR
clear=all>
<DIV><BR></DIV>-- <BR>Petr Krysl
<DIV>University of California, San Diego</DIV>
<DIV>Skype: <A href="http://Petr.Krysl.UCSD.EDU"
target=_blank>Petr.Krysl.UCSD.EDU</A></DIV>
<DIV><A href="http://hogwarts.ucsd.edu/~pkrysl/"
target=_blank>http://hogwarts.ucsd.edu/~pkrysl/</A></DIV><BR></DIV></BODY></HTML>