CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

How to read vtk format using fortran code?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 30, 2010, 03:41
Default How to read vtk format using fortran code?
  #1
Member
 
yu
Join Date: Nov 2010
Posts: 39
Rep Power: 6
xiyuqiu is on a distinguished road
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?
xiyuqiu is offline   Reply With Quote

Old   December 2, 2010, 07:15
Default
  #2
Senior Member
 
Rami Ben-Zvi
Join Date: Mar 2009
Posts: 148
Rep Power: 8
Rami is on a distinguished road
Try
Read(11,*) ( x(i),y(i),z(i), i = 1 , nodes )
Rami is offline   Reply With Quote

Old   December 11, 2010, 21:18
Default
  #3
New Member
 
Igor
Join Date: Dec 2010
Posts: 3
Rep Power: 6
raggar is on a distinguished road
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.

Last edited by raggar; December 11, 2010 at 22:30.
raggar is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
use GAMBIT then read the coord by fortran solver A. Chehhat FLUENT 1 June 12, 2008 13:59
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 15:37
what is the format of.txt file for scanf to read lamlash FLUENT 0 July 17, 2006 18:04
grid data to be read by Fortran code seckin FLUENT 0 April 19, 2003 14:03
seeking fortran code for LEE ahmed m.abdulla Main CFD Forum 0 January 14, 1999 12:16


All times are GMT -4. The time now is 00:52.