[Fortran] 纯文本查看 复制代码
subroutine read_obstacles(obst)
implicit none
include "head.inc"
EXTERNAL sum
complex h(51,51),h1(51,51),F(51,51),F1(51,51),
&obst(51,51)
integer k,l,P,Q
integer x,y
do 11 k= 1, 51
do 10 l = 1, 51
F(P,Q)=0.675*0.675*(exp(-2.3*((k/50)*(k/50)+(l/10)*
& (l/10))**0.5))*((-1)**(2*k*P/50+2*l*Q/50))
if (k==(1,51).and.l==(1,51))then
F1(P,Q)=sum(F,1,[1:51,1:51])
end if
10 continue
11 continue
do 20 P=1,51
do 21 Q=1, 51
h(k,l)=1/10000*F1(P,Q)*(-1)**((k*P+l*Q)/26)
if (P==(1,51).and.Q==(1,51))then
h1(k,l)=sum(h,1,[1:51,1:21])
end if
21 continue
20 continue
do 22 k= 1, 51
do 23 l = 1, 51
call RANDOM_SEED()
call RANDOM_NUMBER()
obst(lx,ly)=h1(k,l)*random_number(lx,ly)
if (lx==(1,51).and.ly==(1,51))then
obst(x,y)=sum(obst,1,[1:51,1:21])
end if
23 continue
22 continue
end