- #1
s_hy
- 61
- 0
hi all...i have problem in understanding in array index. my codes are as below
and i got this warning when execute
subroutines.f90:167.48:
Hinc = (1-dp)*Hm(int(dpp)-0.5)+dp*Hm(0.5+int(dpp))
1
Warning: Extension: REAL array index at (1)
subroutines.f90:167.28:
Hinc = (1-dp)*Hm(int(dpp)-0.5)+dp*Hm(0.5+int(dpp))
1
Warning: Extension: REAL array index at (1)
###########################################
the problem come from line 167 and i found out that fortran do not allow real index...(int(dpp) -0.5)..can anyone give me an advice how to solve this problem.
thank you in advance
Code:
subroutine tmz2d
implicit none
double precision :: phi
double precision :: cosphi,sinphi
double precision :: d,dp,dpp,d1,d2
integer :: i,j,m,h
integer :: minit,mlast
integer :: l,p
integer :: iinit,ilast,hlast,pinit,plast
integer :: n
integer :: linit,llast
integer :: jinit,jlast
double precision,dimension(200) :: Hm,Em
double precision :: Einc,Hinc
double precision,dimension(200,200):: Ezinc,Hxinc,Hyinc
double precision, parameter :: pi = 3.14159265
character(len=20) :: filename
minit = 1
mlast = 100
linit = 1
llast = 100
pinit = 1
plast = 100
iinit = 1
ilast = 100
jinit = 1
jlast = 100
phi = pi/4.0
cosphi = cos(phi)
sinphi = sin(phi)
print *, 'cosphi=',cosphi,'sinphi=',sinphi
do n = 1,100
write (filename, "('data',I3.3,'.dat')") n
open (unit=130,file=filename)
call bg1d
!print *, 'see me2'
do m = 2,2*ilast-1
do p = 2,2*jlast-1
if (Mod(m,2)/=0) then
if (Mod(p,2)/=0) then
d = cosphi*(m - minit) + sinphi*(p - pinit)
dp = d - int(d)
Einc = (1-dp)*Em(int(d))+dp*(Em(int(d)+1))
Ezinc(m,p+2) = Einc
write(130,*) Ezinc(m,p+2)
end if
end if
end do
end do
do m = 2,2*ilast-1
do p = 2,2*jlast-1
if (Mod(m,2) == 0) then
if (Mod(p,2) == 0) then
d = cosphi*(m - minit) + sinphi*(p - pinit)
dpp = d+1
dp = dpp-int(d)
Hinc = (1-dp)*Hm(int(dpp)-0.5)+dp*Hm(0.5+int(dpp))
Hxinc(m,p+1) = sinphi*Hinc
Hyinc(m-1,p+2) = -cosphi*Hinc
end if
end if
end do
end do
end do !n
print *, 'see me3'
end subroutine tmz2d
and i got this warning when execute
subroutines.f90:167.48:
Hinc = (1-dp)*Hm(int(dpp)-0.5)+dp*Hm(0.5+int(dpp))
1
Warning: Extension: REAL array index at (1)
subroutines.f90:167.28:
Hinc = (1-dp)*Hm(int(dpp)-0.5)+dp*Hm(0.5+int(dpp))
1
Warning: Extension: REAL array index at (1)
###########################################
the problem come from line 167 and i found out that fortran do not allow real index...(int(dpp) -0.5)..can anyone give me an advice how to solve this problem.
thank you in advance