program eoshift_test
implicit none
integer:: i
integer,dimension(:,:,:),allocatable:: a
integer,dimension(:,:,:),allocatable:: temp !临时数组
integer:: grid=1000,dim1=30 ! 数组大小
real:: time_start, time_end ! 计时
allocate(a(dim1,grid,grid))
allocate(temp(dim1,grid,grid))
a=0
temp=0
!===== 用 eoshift函数 ==================
call cpu_time(time_start)
a=eoshift(a,shift=1,boundary=0,dim=1)
call cpu_time(time_end)
write(*,*) 'function eoshift:'
write(*,*) time_end-time_start,'seconds elapsed'
!====== 用常规方法 =======================
call cpu_time(time_start)
do i =1, dim1-1
temp(i,:,:)=a(i+1,:,:)
end do
a=temp
a(dim1,:,:)=0
call cpu_time(time_end)
write(*,*) 'normal method:'
write(*,*) time_end-time_start,'seconds elapsed'
end
{31522AA7-DFF2-402A-A5FF-7E202B389BF3}.png.jpg (99.48 KB, 下载次数: 370)
Linux下也报错
{63225753-1D20-44ED-B8E2-D1A1AD76F591}.png.jpg (78.36 KB, 下载次数: 344)
visual studio StackOverflow
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |