主题:[讨论]这个程序如何解读?
program test
implicit none
integer ::i,j
integer ::NF,Nx,M
real(kind=8) ::N,x(1000,100),y(1000,100),z(1000,100),dx(1000,100),dy(1000,100),dz(1000,100)!这个是定义?
character ::inputfile*80,outputfile*80 !这个是什么意思?
NF=120 !number of the f values
Nx=40 !number of x values
M=5 !number of the useless lines on the top of the input file !无用的行?
N=0.1 !the parameter in formula x=x+N*dx
write(*,*) "Name of input file:"
read(*,*) inputfile
open(unit=7,file=inputfile)
do i=1,M
read(7,*)
enddo
do i=1,NF,1
read(7,*)
read(7,*)
do j=1,Nx,1
read(7,*) x(i,j),y(i,j),z(i,j),dx(i,j),dy(i,j),dz(i,j)
x(i,j)=x(i,j)+N*dx(i,j)
y(i,j)=y(i,j)+N*dy(i,j)
z(i,j)=z(i,j)+N*dz(i,j)
enddo
read(7,*)
enddo
write(*,*) "Name of the output file:"
read(*,*) outputfile
open(unit=17,file=outputfile)
do i=1,NF,1
write(17,*) 'f=',i
do j=1,Nx,1
write(17,999) x(i,j),y(i,j),z(i,j)
enddo
enddo
999 format(3(f10.6,1x))!999是什么?
end program
这是一个从文件中读取数据的程序,未调试。哪位能详解一下此程序。本人新手。
implicit none
integer ::i,j
integer ::NF,Nx,M
real(kind=8) ::N,x(1000,100),y(1000,100),z(1000,100),dx(1000,100),dy(1000,100),dz(1000,100)!这个是定义?
character ::inputfile*80,outputfile*80 !这个是什么意思?
NF=120 !number of the f values
Nx=40 !number of x values
M=5 !number of the useless lines on the top of the input file !无用的行?
N=0.1 !the parameter in formula x=x+N*dx
write(*,*) "Name of input file:"
read(*,*) inputfile
open(unit=7,file=inputfile)
do i=1,M
read(7,*)
enddo
do i=1,NF,1
read(7,*)
read(7,*)
do j=1,Nx,1
read(7,*) x(i,j),y(i,j),z(i,j),dx(i,j),dy(i,j),dz(i,j)
x(i,j)=x(i,j)+N*dx(i,j)
y(i,j)=y(i,j)+N*dy(i,j)
z(i,j)=z(i,j)+N*dz(i,j)
enddo
read(7,*)
enddo
write(*,*) "Name of the output file:"
read(*,*) outputfile
open(unit=17,file=outputfile)
do i=1,NF,1
write(17,*) 'f=',i
do j=1,Nx,1
write(17,999) x(i,j),y(i,j),z(i,j)
enddo
enddo
999 format(3(f10.6,1x))!999是什么?
end program
这是一个从文件中读取数据的程序,未调试。哪位能详解一下此程序。本人新手。