DO循环中IF条件的奇怪标签用法 [英] Strange label usage for an IF condition in a DO loop

查看:198
本文介绍了DO循环中IF条件的奇怪标签用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定哪个版本的Fortran是这段代码,我也不是很擅长,但是这里是我试图理解的一段代码...

  DO 55 J = 1,N 
IF(KODE(J))55,55,40! (I,J)= - H(I,J)= H(I,J)$ B $
H(I,J)= - CH
50 CONTINUE
55 CONTINUE

在上面给出的循环中,能否帮助我理解第二行的作用,特别是标签55,55,40 p 这是一段代码我试图理解的边界元素书...

解决方案

哇...我还没有看到这个语法一会儿。这是一个Fortran算术IF语句 KODE(J)的结果是一个数字。如果它小于零,则使用第一跳,如果它等于零,则使用第二跳,否则使用第三跳。这大致相当于:

  X = KODE(J)
IF(X.LT.0) 55
IF(X.EQ.0)前往55
前往40



<我的Fortran技能已经明显褪色,但这是我记得的。


I am not sure which version of Fortran is this piece of code, also I am not very good at it but here is the piece of code that I try to understand...

      DO 55 J=1,N  
      IF(KODE(J)) 55,55,40  ! Can not figure out what this line does
   40 DO 50 I=1,N  
      CH=G(I,J) 
      G(I,J)=-H(I,J)
      H(I,J)=-CH
   50 CONTINUE
   55 CONTINUE

In the loop given above, could you help me to understand what the 2nd line does, specifically the labels 55,55,40

This is a code from a boundary element book that I am trying to understand...

解决方案

Wow ... I haven't seen that syntax in a while. That is a Fortran Arithmetic IF Statement. The result of KODE(J) is a number. If it is less than zero, then the first jump is used, if it is equal to zero, then the second jump is used, otherwise, the third jump is used. This is roughly equivalent to:

X=KODE(J)
IF (X.LT.0) GO TO 55
IF (X.EQ.0) GO TO 55
GO TO 40

My Fortran skills have faded significantly, but this is what I remember.

这篇关于DO循环中IF条件的奇怪标签用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆