Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does this do? 2

Status
Not open for further replies.

TheoMoore

Programmer
Feb 11, 2008
5
GB
I'm trying to interpret someone's Fortran code. He's written the following:

Code:
IMPLICIT REAL*8 (A-H,O-Z)

DIMENSION WEW(2710,2710),LV(2710),W(2710)

1,ETA(2710)

COMMON /FUN/ Z(2710),zm(2710),E,M,MM,U(2710),FIFI(2710),N,NP,PI

1,AZ(2710),DZ(2710)

1,Y(2710),x(2710)

1,gr,lcon

What does the '1,' do?
What does the /FUN/ do?
 
Hi TheoMoore,

The "1" means just to continue onto the next line, i.e.

DIMENSION WEW(2710,2710),LV(2710),W(2710)

1,ETA(2710)

means the same as

DIMENSION WEW(2710,2710),LV(2710),W(2710),ETA(2710)

The "/FUN/" is the name of the common block. So if you wanted to access the variables "Z(2710),zm(2710),E,..." in any other subroutine / function, you just have to put "COMMON /FUN/..." again at the top of that routine. You can use any name you want, just make sure it's the same one in all routines.

Simon.
 
> The "1" means just to continue onto the next line

Oh. I had this impression as well, but I always thought that was what the ampersand was used for.

Thanks for your help
 
The 1 in the line
Code:
[COLOR=red]1[/color],AZ(2710),DZ(2710)
is the continuation character, i.e. the line belong to previous line - it could be in one line
Code:
COMMON [COLOR=green]/FUN/[/color] Z(2710),zm(2710),E,M,MM,U(2710),FIFI(2710),N,NP,PI,AZ(2710),DZ(2710)
but probably because the line would have more than 72 characters it was divided into 2 lines.

/FUN/ is the name of the COMMON blocks.
 
Also, what does this do?

Code:
  DO 2 K = L, N
  Z = DABS(A(L,K))
  IF (Z - PIVOT) 2,2,1
1  LIG(L) = K
   PIVOT = Z
2  CONTINUE

I can't make any sense of the IF statement. What does 2,2,1 do? Why isn't there a logical operator that follows (Z-PIVOT)?

What version of Fortran coding is this? I'm familiar (a bit) with the F90, but can't make heads or tails of this.
 
It is
DO K = L, N
...
loop and instead of ENDDO it goes until the line labeled with label 2 i.e
2 CONTINUE

The IF branches to specified labels, when
Z - PIVOT < 0, Z - PIVOT = 0, Z - PIVOT > 0
(I'm not sure in which order)

Search for a manual for Fortran 77.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top