CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   How to read vtk format using fortran code? (http://www.cfd-online.com/Forums/main/82576-how-read-vtk-format-using-fortran-code.html)

xiyuqiu November 30, 2010 03:41

How to read vtk format using fortran code?
 
Hello all,

I am trying to write a fortran code to read a vtk file. When I am trying to read the following part

0 0 0 1 0 0 2 0 0 0 1 0 1 1 0 2 1 0
0 0 1 1 0 1 2 0 1 0 1 1 1 1 1 2 1 1
0 1 2 1 1 2 2 1 2 0 1 3 1 1 3 2 1 3
0 1 4 1 1 4 2 1 4 0 1 5 1 1 5 2 1 5
0 1 6 1 1 6 2 1 6

I run into some trouble. Those numbers are x, y, z's, in this order.

(0,0,0) (1,0,0) .... and so on. I know how many points that I have 27 this case. What kind of read statement should I have? I had

Do i = 1 , nodes
Read(11,*) x(i),y(i),z(i)
End do

I know this is not right since it only read the first three numbers of each row. Any ideas?

Rami December 2, 2010 07:15

Try
Read(11,*) ( x(i),y(i),z(i), i = 1 , nodes )

raggar December 11, 2010 21:18

can be:

program ...

type xyz
real :: x, y, z
end type xyz

integer, parameter :: N=27 !numbers of point
type (xyz), dimansion(N) :: data_num
read (....) data_num


end program ....

You can to use dynamic array.


All times are GMT -4. The time now is 04:28.