今天调试程序的时候发现一个非常有意思的问题,我的编译器是IVF2013 update1,平台是VS2012,系统win7 32bit
我把程序单独拿出来了,数据见文件。
程序如下:
[Fortran] 纯文本查看 复制代码 Program MemTest
Implicit None
Integer :: nEle, nNod
Integer, Allocatable :: emap(:,:)
Integer, Allocatable :: nEleIn(:),nodEle(:,:)
Integer :: i, j
Open( Unit = 11, File = 'in.dat' )
Read(11,*) nEle, nNod
allocate( emap(3,nEle) )
Read(11,*) emap
Close( Unit = 11 )
allocate( nEleIn( nNod ), nodEle( nNod,15) )
nEleIn = 0
nodEle = 0
!
! Loop all element
!
DO i = 1, nEle
nelein(emap(:,i)) = nelein(emap(:,i)) + 1
nodele(emap(:,i),nelein(emap(:,i))) = i
EndDo
Write(*,*) nEleIn(88)
write(*,*) nodEle( 88, : )
! Anothe Method
! initial zeros
nEleIn = 0
nodEle = 0
DO i = 1, nEle
ForAll( j = 1 : 3 )
nelein(emap(j,i)) = nelein(emap(j,i)) + 1
nodele(emap(j,i),nelein(emap(j,i))) = i
EndForAll
EndDo
Write(*,*) nEleIn(88)
write(*,*) nodEle( 88, : )
!
! deallocate Memory
!
Deallocate( emap, nEleIn, nodEle )
stop
End Program MemTest
输出结果为:
附件,输入数据文件:
|