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.
 
Paul

  _____  

From: [email protected] [mailto:[email protected]] On Behalf Of Petr
Krysl
Sent: Monday, 30 July 2012 2:49 PM
To: Paul McIntosh
Cc: [email protected]
Subject: Re: [Paraview] Do anyone have examples of writing binary file with
mesh and results data?


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
<[email protected]> 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: [email protected] [mailto:[email protected]]
On Behalf Of Petr Krysl
Sent: Saturday, 28 July 2012 1:37 AM
To: [email protected]
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/

_______________________________________________
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

Reply via email to