Basic HTML version of Foils prepared August 7 98

Foil 9 Typical Uses of Array Operations

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


Scaling
  • REAL u(0:nx,0:ny), fact, avg
  • u = fact * (u - avg)
Computing a residual (version 1)
  • REAL r(0:nx,0:ny), u(0:nx,0:ny),f(0:nx,0:ny)
  • r(0:nx:jmp,0:ny:jmp)=-u(0:nx:jmp,0:ny:jmp)+ &
    • 0.25*(CSHIFT(u(0:nx:jmp,0:ny:jmp),1,1) + &
    • CSHIFT(u(0:nx:jmp,0:ny:jmp),-1,1) + &
    • CSHIFT(u(0:nx:jmp,0:ny:jmp),1,2) + &
    • CSHIFT(u(0:nx:jmp,0:ny:jmp),-1,2)) + &
    • f(0:nx:jmp,0:ny:jmp)
Computing a residual (version 2)
  • REAL r(:,:), u(:,:), f(:,:)
  • r = - u+0.25*(CSHIFT(u,1,1)+CSHIFT(u,-1,1)+ &
    • CSHIFT(u,1,2)+CSHIFT(u,-1,2)) + f



© 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