Fortran 90: a conversion course for Fortran 77 programmers by Walter S. Brainerd, Charles H. Goldberg, Jeanne C. Adams

By Walter S. Brainerd, Charles H. Goldberg, Jeanne C. Adams

Those scholar notes have been constructed utilizing the Manchester Computing Centre Fortran90 direction, which was once compiled via J M Brooke, G S Noland, and M A Pettipher as abasis.

Show description

Read Online or Download Fortran 90: a conversion course for Fortran 77 programmers PDF

Similar programming: programming languages books

Additional info for Fortran 90: a conversion course for Fortran 77 programmers

Example text

For example, suppose we want to have access the integers i, j, k and the reals a, b, c in different procedures. Simply place the appropriate declaration statements in a module as follows: MODULE globals REAL, SAVE :: a,b,c INTEGER, SAVE :: i,j,k END MODULE globals Note the use of the SAVE attribute. This allows modules to be used to provide global data. This simple use of the module is a substitute for the COMMON block used previously in Fortran 77. e. USE globals The USE statement is non-executable, and must appear at the very beginning of a program unit before any other non-executables, and after the PROGRAM, or other program unit statement.

13 Assumed Shape Arrays An assumed shape array is an array whose shape is not known, but which takes on whatever shape is imposed by the actual argument. When declaring an assumed shape array, each dimension is specified as: [lower_bound]: 54 Fortran 90 Student Notes Array Processing where the lower bound defaults to 1 if omitted. Assumed shape arrays make possible the passing of arrays between program units without having to pass the dimensions as arguments. However, if an external procedure has an assumed shape array as a dummy argument, then an interface block must be provided in the calling program unit.

END SUBROUTINE sub The calling program might include: REAL, DIMENSION (0:9,10) :: ra ! Shape (10, 10) INTERFACE SUBROUTINE sub(ra,rb,rc) REAL, DIMENSION(:,:), INTENT(IN) :: ra,rb REAL, DIMENSION(0:,2:), INTENT(OUT) :: rc END SUBROUTINE sub END INTERFACE . . : PROGRAM array IMPLICIT NONE REAL, ALLOCATABLE, DIMENSION(:,:) :: a REAL :: res INTEGER :: n1 INTERFACE SUBROUTINE sub(a,res) REAL, DIMENSION(:, :), INTENT(IN) :: a REAL, DIMENSION(SIZE(a, 1),SIZE(a, 2)) :: work END SUBROUTINE sub END INTERFACE ...

Download PDF sample

Rated 4.46 of 5 – based on 20 votes