[Fortran] 纯文本查看 复制代码
program juzhenhua implicit none
integer i,j,stress,nstress,nrow,ncol
integer rowbe,colbe,rowen,colen
REAL, save,dimension (:,:,:), allocatable :: darray
character(len=8)::form,access
integer::nr
i=1
j=1
stress=1
write(*,*) "输入应力期"
read(*,*) nstress
write(*,*) "输入行数"
read(*,*) nrow
write(*,*) "输入列数"
read(*,*) ncol
write(*,*) "起始行号"
read(*,*) rowbe
write(*,*) "起始列号"
read(*,*) colbe
write(*,*) "结束行号"
read(*,*) rowen
write(*,*) "结束列号"
read(*,*) colbe
allocate (darray(1:nrow,1:ncol,1:nstress))
inquire (file="E:\near\6666666666666\降雨量模型导出和计算\尝试.txt",ACCESS=access,form=form,nextrec=nr)
write(*,*)"access=",access
write(*,*)"form=",form
write(*,*)"nextrec=",nr
open(unit=12,file="E:\near\6666666666666\降雨量模型导出和计算\尝试.txt")
rewind(12)
do stress=1,nstress
do i=1,nrow
do j=1,ncol
read(12,*)darray(i,j,stress)
write(*,*)darray(i,j,stress)
enddo
enddo
enddo
close(12)
open(unit=11,file="E:\near\6666666666666\降雨量模型导出和计算\降雨shuchu.txt")
write(11,*) "1 41 1"
do stress=1,nstress
write(11,*) "1 -1"
write(11,*) "INTERNAL 1.0 (free) 0"
do i=rowbe,rowen
do j=colbe,colen
write(11,*)darray(i,j,stress)
enddo
enddo
enddo
close(11)
deallocate (darray)
read(*,*)
end program juzhenhua