real,allocatable::x(:,:,,y(:,:,,z(:,:,
real,allocatable::x1(:),y1(:),z1(:)
write(*,*) 'grid file name'
read(*,*) gridfile
ind=index(gridfile,' ')
open(1,file=gridfile(:ind-1),STATUS='UNKNOWN')
read(1,*) n_block
read(1,*) io,jo,ko
close(1)
nijk=io*jo*ko
m=int(nijk/4)
mmod=nijk-4*m
allocate(x(io,jo,ko),y(io,jo,ko),z(io,jo,ko))
allocate(x1(nijk),y1(nijk),z1(nijk))
open(1,file=gridfile(:ind-1),STATUS='UNKNOWN')
read(1,*) n_block
read(1,*) io,jo,ko
do 111 i=0,m-1
111read(1,*) x1(4*i+1),x1(4*i+2),x1(4*i+3),x1(4*i+4)
if(mmod.ne.0) then
do i=4*m+1,nijk
read(1,*) x1(i)
enddo
endif
do 112 i=0,m-1
112read(1,*) y1(4*i+1),y1(4*i+2),y1(4*i+3),y1(4*i+4)
if(mmod.ne.0) then
do i=4*m+1,nijk
read(1,*) y1(i)
enddo
endif
do 113 i=0,m-1
113read(1,*) z1(4*i+1),z1(4*i+2),z1(4*i+3),z1(4*i+4)
if(mmod.ne.0) then
do i=4*m+1,nijk
read(1,*) z1(i)
enddo
endif
close(1)
mm=0
do 11 k=ko,1,-1
do 11 j=jo,1,-1
do 11 i=io,1,-1
mm=1+mm
x(i,j,k)=x1(mm)
y(i,j,k)=y1(mm)
z(i,j,k)=z1(mm)
11continue
OPEN(12,FILE=gridfile(:ind-5)//'_ijk.plt',STATUS='UNKNOWN')
write(12,*)'zone i=',io,' j=',jo,' k=',ko,' f=point'
do 114 k=1,ko
do 114 j=1,jo
do 114 i=1,io
write(12,*) x(i,j,k),y(i,j,k),z(i,j,k)
114continue
CLOSE(12)
end
|