[Paraview] Do anyone have examples of writing binary file with mesh and results data?
Petr Krysl
pkrysl at ucsd.edu
Mon Jul 30 00:48:32 EDT 2012
Paul,
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:
…
for k=1:length(Connectivity)
f=Connectivity{k};
ctype=zeros(size(f, 1),1)+Cell_types{k};
fprintf(fid,'CELLS %d %d\n',size(f,1),(size(f,1)*(size(f,2)+1)));%
if (~binary)
for i= 1:size(f, 1)
fprintf(fid,'%d ',size(f,2));
for j= 1: size(f,2)
fprintf(fid,'%d ',f(i,j)-1);
end
fprintf(fid,'\n');
end
else
fwrite(fid,cast([zeros(size(f,1),1)+size(f,2),f-1],'int32'),'int32','b');
end
fprintf(fid,'\n');
fprintf(fid,'\n');
fprintf(fid,'CELL_TYPES %d\n',size(f,1));%
if (~binary)
for i= 1:size(f, 1)
fprintf(fid,'%d\n',ctype(i));
end
else
fwrite(fid,cast(ctype,'int32'),'int32','b');
end
fprintf(fid,'\n');
fprintf(fid,'\n');
end
…
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.
It is just the unstructured grid that's giving me headaches.
Petr
On Sun, Jul 29, 2012 at 8:29 PM, Paul McIntosh <
paul.mcintosh at internetscooter.com> wrote:
> **
> Maybe check 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.
>
> Paul
>
> ------------------------------
> *From:* paraview-bounces at paraview.org [mailto:
> paraview-bounces at paraview.org] *On Behalf Of *Petr Krysl
> *Sent:* Saturday, 28 July 2012 1:37 AM
> *To:* paraview at paraview.org
> *Subject:* Re: [Paraview] Do anyone have examples of writing binary file
> with mesh and results data?
>
> Hi,
>
> 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.
>
> Thanks,
> --
> Petr Krysl
> University of California, San Diego
> Skype: Petr.Krysl.UCSD.EDU
> http://hogwarts.ucsd.edu/~pkrysl/
>
>
--
Petr Krysl
University of California, San Diego
Skype: Petr.Krysl.UCSD.EDU
http://hogwarts.ucsd.edu/~pkrysl/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120729/9f7bce9c/attachment.htm>
More information about the ParaView
mailing list