[Paraview] help
Hom Nath Gharti
hng.email at gmail.com
Fri Nov 19 08:08:40 EST 2010
I think:
1. It should be "DATASET UNSTRUCTURED_GRID" not "DATASET STRUCTURED_GRID"
2. In CELLS it should be NC*5 not NC*4, because this represents the total
number of integer values in the CELL list. In your case it is (Number of
elements*(1 + Number of nodes per element))
3. In the CELL list you should have
Number of nodes per element, node1, node2, node3, node4
...
...
Therefore, it should be:
fprintf(fp,'%d %d %d %d
%d\n',4,Cells(1,i)-1,Cells(2,i)-1,Cells(3,i)-1,Cells(4,i)-1);
4. Because you are displaying Quadrilateral, in the list of CELL_TYPE you
should use:
fprintf(fp,'%d\n',9); not fprintf(fp,'%d\n',4); 4 is for polyline see
figure 3 of (5)
5. See http://www.vtk.org/VTK/img/file-formats.pdf for detail
Good luck!
HNG
On Fri, Nov 19, 2010 at 7:45 AM, 乔彦超 <oliver.qiao at gmail.com> wrote:
> Hi:
>
> i want write my results into VTK format, then i can use the paraview.
> but i have some problem. my compute model is 700KM*700KM, there are 71*71
> nodes. it's a Quadrilateral mesh.
>
> my matlab code as followed
> % Model size, m
> xsize=700000;
> ysize=700000;
> % Defining resolution
> xnum=71;
> ynum=71;
> NP=xnum*ynum;
> NC=xnum*ynum-2*xnum+1;
> % Defining gridline positions for regular basic grid
> % In horizontal direction
> gridx=zeros(xnum,1);
> for i=2:1:xnum
> gridx(i)=gridx(i-1)+xstp;
> end
> % Defining gridline positions for 51x51 irregular basic grid
> % In vertical direction
> gridy=zeros(ynum,1);
> for i=2:1:6
> gridy(i)=gridy(i-1)+20000;
> end
> for i=7:1:46
> gridy(i)=gridy(i-1)+1250;
> end
> for i=46:1:51
> gridy(i)=gridy(i-1)+10000;
> end
> for i=51:1:71
> gridy(i)=gridy(i-1)+25000;
> end
> gridy(ynum)=ysize;
>
> %write the points
> a=0;
> for i=1:1:ynum
> for j=1:1:xnum
> a=a+1;
> Points(1,a)=gridx(j);
> Points(2,a)=gridy(i);
> end
> end
> % write the cell
> nn=0;
> for j=1:1:ynum
> for i=1:1:xnum
> nn=nn+1;
> Cells(1,nn)=(j-1)*(xnum+1)+i;
> Cells(2,nn)=(j-1)*(xnum+1)+i+1;
> Cells(3,nn)=j*(xnum+1)+i+1;
> Cells(4,nn)=j*(xnum+1)+i;
> Cells(5,nn)=nn;
> end
> end
> % write VTK file
> fp=fopen('Resault.vtk','w');
> fprintf(fp,'# vtk DataFile Version 3.0\n');
> fprintf(fp,'vtk output\n');
> fprintf(fp,'ASCII\n');
> fprintf(fp,'DATASET STRUCTURED_GRID\n');
> fprintf(fp,'POINTS %d float\n',NP);
> for i=1:NP
> fprintf(fp,'%e %e %e \n',Points(1,i),Points(2,i),0);
> end
> fprintf(fp,'\n');
> fprintf(fp,'CELLS %d %d\n',NC,NC*4);
> aa=0;
> for i=1:NC
> aa=aa+1;
> fprintf(fp,'%d %d %d %d
> %d\n',aa,Cells(1,i)-1,Cells(2,i)-1,Cells(3,i)-1,Cells(4,i)-1);
> end
> fprintf(fp,'\n');
> fprintf(fp,'CELL_TYPES %d\n',NC);
> for i=1:NC
> fprintf(fp,'%d\n',4);
> end
> fprintf(fp,'\n');
> fprintf(fp,'POINT_DATA %d\n',NP);
>
> when i tried to open it with paraview.
> it sayed "ERROR: In
> C:\berk\ReleaseBuilds\ParaView3\VTK\IO\vtkDataReader.cxx, line 2078
> ERROR: In C:\berk\ReleaseBuilds\ParaView3\VTK\IO\vtkDataReader.cxx, line
> 2078
> ERROR: In
> C:\berk\ReleaseBuilds\ParaView3\VTK\Parallel\vtkPDataSetReader.cxx, line 705
> vtkPDataSetReader (0AEA4D18): Expecting 'DIMENSIONS' insted of: POINTS
> ERROR: In
> C:\berk\ReleaseBuilds\ParaView3\VTK\Parallel\vtkPDataSetReader.cxx, line 705
> vtkPDataSetReader (0AEA4D18): Expecting 'DIMENSIONS' insted of: POINTS"
>
> What's the problem? could you help me?
>
> thank you very much.
>
> Best regards!
>
> --
> Yanchao Qiao
> Ph.D student of Geodynamics
>
> +86-136 010 926 41
>
> College of Earth Science
> Graduate University of Chinese Academy of Sciences
>
> 19A, YuQuan Road, Beijing, China, 100049
> Email:oliver.qiao at 163.com <Email%3Aoliver.qiao at 163.com>;
> oliver.qiao at gmail.com;qiaoyanchao07 at mails.gucas.ac.cn
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20101119/8445f15a/attachment.htm>
More information about the ParaView
mailing list