02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Arrays<br />

Array declarations<br />

If a procedure has an argument that is an assumed-shape array, its interface must be explicit<br />

within the calling program unit. A procedure’s interface is explicit if it is an internal<br />

procedure within the caller procedure or if the interface is declared in an interface block<br />

within the caller.<br />

For example, to call the external subroutine initialize in the previous example, its interface<br />

must appear in an interface block, as in the following:<br />

PROGRAM main<br />

INTEGER :: parts(0:100)<br />

COMPLEX :: coeffs(100)<br />

REAL :: omega(-2:+3, -1:+3, 0:3, 1:3, 2:3)<br />

INTERFACE<br />

SUBROUTINE initialize (a,b,c,n)<br />

INTEGER :: n<br />

INTEGER :: a(:)<br />

COMPLEX :: b(ABS(n):)<br />

REAL, DIMENSION(:,:,:,:,:) :: c<br />

END SUBROUTINE initialize<br />

END INTERFACE<br />

CALL initialize(parts,coeffs,omega,lbound(omega,1))<br />

.<br />

.<br />

.<br />

END PROGRAM main<br />

SUBROUTINE initialize (a,b,c,n)<br />

INTEGER :: n<br />

INTEGER :: a(:)<br />

COMPLEX :: b(ABS(n):)<br />

REAL, DIMENSION(:,:,:,:,:) :: c<br />

.<br />

.<br />

.<br />

END SUBROUTINE initialize<br />

For more information about:<br />

60<br />

Internal procedures, see “Internal procedures” on page 135<br />

Interface blocks, see “Procedure interface” on page 149<br />

Arrays used as dummy arguments, see “Array dummy argument” on page 140<br />

Chapter 4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!