声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1639|回复: 2

[Fortran] 问一个关于if语句的问题

[复制链接]
发表于 2007-12-12 21:45 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
subroutine ghmatec(x,y,xm,ym,g,h,fi,dfi,kode,nx)
dimension g(nx,nx),h(nx,nx)
dimension x(1),y(1),xm(1),ym(1),fi(1),kode(1),dfi(1)
common n,l,nc(5),m,ge,xnu,inp,ipr
x(n+1)=x(1)
y(n+1)=y(1)
do 10 i=1,n
xm(i)=(x(i)+x(i+1))/2
10 ym(i)=(y(i)+y(i+1))/2
if (m-1) 15,15,12
12 xm(nc(1))=(x(nc(1))+x(1))/2
      ym(nc(1))=(y(nc(1))+y(1))/2
do 13 k=2,m
xm(nc(K))=(x(nc(k))+x(nc(k-1)+1))/2
13 ym(nc(K))=(y(nc(k))+y(nc(k-1)+1))/2
15 do 30 i=1,n
do 30 j=1,n
if(m-1) 16,16,17
17   if(j-nc(1))19,18,19
18   kk=1
      go to 23
19   do 22 k=2,m
      if (j-nc(k)) 22,21,22
21 kk=nc(k-1)+1
      go to 23
22    continue
16    kk=j+1
23    if(i-j) 20,25,20
20    call extinec(xm(i),ym(i),x(j),y(j),x(kk),y(kk),h((2*i-1),(2*j-1)),
     *h((2*i-1),(2*j)),h((2*i),(2*j-1)),h((2*i),(2*j)),g((2*i-1),(2*j-1)
     *),g((2*i-1),(2*j)),g((2*i),(2*j)))
g((2*i),(2*j-1))=g((2*i-1),(2*j))
go to 26
25    call locinec(x(j),y(j),x(kk),y(kk),g((2*i-1),(2*j-1)),
     *g((2*i-1),(2*j)),g((2*i),(2*j)))
  h((2*i-1),(2*j-1))=0.5
h((2*i),(2*j))=0.5
h((2*i-1),(2*j))=0
h((2*i),(2*j-1))=0
g((2*i),(2*j-1))=g((2*i-1),(2*j))
26 continue
30    continue
      nn=2*n
do 50 j=1,nn
if (kode(j))43,43,40
40    do 42 i=1,nn
      ch=g(i,j)
g(i,j)=-h(i,j)
42    h(i,j)=-ch
      go to 50
43    do 45 i=1,nn
45    g(i,j)=g(i,j)*ge
50    continue
      do 60 i=1,nn
dfi(i)=0
do 60 j=1,nn
dfi(i)=dfi(i)+h(i,j)*fi(j)
60    continue
      return
end

虽然,程序较长,那只是为了完整.

我只是想问下,红色的部分, if (m-1) 15,15,12 是什么意思?
是不是m-1为真,转到15?
后面3个数字不懂什么意思...
回复
分享到:

使用道具 举报

发表于 2007-12-12 21:55 | 显示全部楼层
看这段帮助

IF -- Arithmetic
Statement: Conditionally transfers control to one of three statements, based on the value of an arithmetic expression. It is an obsolescent feature in Fortran 95 and Fortran 90.
Syntax
IF (expr) label1, label2, label3
expr
Is a scalar numeric expression of type integer or real (enclosed in parentheses).
label1, label2, label3
Are the labels of valid branch target statements that are in the same scoping unit as the arithmetic IF statement.

例如:
The following example transfers control to statement 50 if the real variable THETA is less than or equal to the real variable CHI. Control passes to statement 100 only if THETA is greater than CHI.

  IF (THETA-CHI) 50,50,100

意思是,如果THETA小于或等于实变量CHI,则转至statement 50,而只有THETA大于CHI的时候,转至statement 100

再如:The following statement transfers control to statement 10 for n < 10, to statement 20 for n = 10, and to statement 30 for n > 10:

  IF (n-10) 10, 20, 30
意思是:n<10时,转至statement 10,n=10时,转至statement 20,而当n>10时,转至statement 30

评分

1

查看全部评分

 楼主| 发表于 2007-12-12 22:04 | 显示全部楼层

回复 #2 octopussheng 的帖子

thank you very much
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-17 18:26 , Processed in 0.063582 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表