Basic HTML version of Foils prepared August 7 98

Foil 7 Typical Uses of Memory Allocation

From DoD HPF Training -- 2. Fortran90 DoD Training and Others -- 1995-98. by Chuck Koelbel -- Rice University


Allocating arrays in main program
  • REAL, ALLOCATABLE :: u(:,:), f(:,:), r(:,:)
  • ALLOCATE( u(0:ni,0:nj), f(0:ni,0:nj), &
    • r(0:ni,0:nj) )
Passing assumed-shape arrays
  • INTERFACE
    • SUBROUTINE residual(x,y,z)
    • REAL x(:,:), y(:,:), z(:,:)
    • END SUBROUTINE
  • END INTERFACE
  • CALL residual( r, u, f )
  • CALL residual( r(0:ni:2,0:nj:2), &
    • u(0:ni:2,0:nj:2), f(0:ni:2,0:nj:2) )



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Aug 9 1998