Hi:<br> <br>i want write my results into VTK format, then i can use the paraview.<br>but i have some problem. my compute model is 700KM*700KM, there are 71*71 nodes. it's a Quadrilateral mesh.<br> <br>my matlab code as followed<br>
% Model size, m<br>xsize=700000;<br>ysize=700000;<br>% Defining resolution<br>xnum=71;<br>ynum=71;<br>NP=xnum*ynum;<br>NC=xnum*ynum-2*xnum+1;<br>% Defining gridline positions for regular basic grid<br>% In horizontal direction<br>
gridx=zeros(xnum,1);<br>for i=2:1:xnum<br> gridx(i)=gridx(i-1)+xstp;<br>end<br>% Defining gridline positions for 51x51 irregular basic grid<br>% In vertical direction<br>gridy=zeros(ynum,1);<br>for i=2:1:6<br> gridy(i)=gridy(i-1)+20000;<br>
end<br>for i=7:1:46<br> gridy(i)=gridy(i-1)+1250;<br>end<br>for i=46:1:51<br> gridy(i)=gridy(i-1)+10000;<br>end<br>for i=51:1:71<br> gridy(i)=gridy(i-1)+25000;<br>end<br>gridy(ynum)=ysize;<br> <br>%write the points<br>
a=0;<br>for i=1:1:ynum<br> for j=1:1:xnum<br> a=a+1;<br> Points(1,a)=gridx(j);<br> Points(2,a)=gridy(i);<br> end<br>end<br>% write the cell<br>nn=0;<br>for j=1:1:ynum<br> for i=1:1:xnum<br> nn=nn+1;<br>
Cells(1,nn)=(j-1)*(xnum+1)+i;<br> Cells(2,nn)=(j-1)*(xnum+1)+i+1;<br> Cells(3,nn)=j*(xnum+1)+i+1;<br> Cells(4,nn)=j*(xnum+1)+i;<br> Cells(5,nn)=nn;<br> end<br>end<br>% write VTK file<br>
fp=fopen('Resault.vtk','w');<br>fprintf(fp,'# vtk DataFile Version 3.0\n');<br>fprintf(fp,'vtk output\n');<br>fprintf(fp,'ASCII\n');<br>fprintf(fp,'DATASET STRUCTURED_GRID\n');<br>
fprintf(fp,'POINTS %d float\n',NP);<br>for i=1:NP<br> fprintf(fp,'%e %e %e \n',Points(1,i),Points(2,i),0);<br>end<br>fprintf(fp,'\n');<br>fprintf(fp,'CELLS %d %d\n',NC,NC*4);<br>aa=0;<br>
for i=1:NC<br> aa=aa+1;<br> 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);<br>end<br>fprintf(fp,'\n');<br>fprintf(fp,'CELL_TYPES %d\n',NC);<br>for i=1:NC<br>
fprintf(fp,'%d\n',4);<br>end<br>fprintf(fp,'\n');<br>fprintf(fp,'POINT_DATA %d\n',NP);<br> <br>when i tried to open it with paraview.<br>it sayed "ERROR: In C:\berk\ReleaseBuilds\ParaView3\VTK\IO\vtkDataReader.cxx, line 2078 <br>
ERROR: In C:\berk\ReleaseBuilds\ParaView3\VTK\IO\vtkDataReader.cxx, line 2078<br>ERROR: In C:\berk\ReleaseBuilds\ParaView3\VTK\Parallel\vtkPDataSetReader.cxx, line 705<br>vtkPDataSetReader (0AEA4D18): Expecting 'DIMENSIONS' insted of: POINTS<br>
ERROR: In C:\berk\ReleaseBuilds\ParaView3\VTK\Parallel\vtkPDataSetReader.cxx, line 705<br>vtkPDataSetReader (0AEA4D18): Expecting 'DIMENSIONS' insted of: POINTS"<br> <br>What's the problem? could you help me?<br>
<br>thank you very much.<br> <br>Best regards!<br clear="all"><br>-- <br>Yanchao Qiao<br>Ph.D student of Geodynamics<br><br>+86-136 010 926 41<br><br>College of Earth Science<br>Graduate University of Chinese Academy of Sciences<br>
<br>19A, YuQuan Road, Beijing, China, 100049<br><a href="mailto:Email%3Aoliver.qiao@163.com">Email:oliver.qiao@163.com</a>;<a href="mailto:oliver.qiao@gmail.com">oliver.qiao@gmail.com</a>;<a href="mailto:qiaoyanchao07@mails.gucas.ac.cn">qiaoyanchao07@mails.gucas.ac.cn</a><br>