      PROGRAM LAPLACE
      INTEGER N,Nsteps
      PARAMETER(N=16)
      PARAMETER(Nsteps = 100)
      INTEGER i,j,k
      REAL A(N,N),B(N,N),C(N,N),D(N,N),tolerence,error
      INTEGER niter,nicycle,x,y
      INTEGER toler(2)
!HPF$ PROCESSORS PROC(2,2)
!HPF$ TEMPLATE TEMP(N,N)
!HPF$ DISTRIBUTE TEMP(BLOCK,BLOCK)
!HPF$ ALIGN A(i,j) with TEMP(i,j)
!HPF$ ALIGN B(i,j) with TEMP(i,j)
!HPF$ ALIGN C(i,j) with TEMP(i,j)
!HPF$ ALIGN D(i,j) with TEMP(i,j)
      FORALL (i=1:N,j=1:N)     A(i,j) = 8.0
      FORALL (i=2:N-1,j=2:N-1) A(i,j) = 2.0
      B = A
      C = A
      DO k = 1, Nsteps
        FORALL (i=2:N-1,j=2:N-1) B(i,j) = (A(i,j-1) + A(i,j+1))*0.25
        FORALL (i=2:N-1,j=2:N-1) B(i,j) = B(i,j)+(A(i-1,j) + A(i+1,j))*0.25
        A=B
      END DO
      print *, 'Final grid looks like'
!      DO I= 1, N/2
!        WRITE(*,101) (A(I,J),J=1,N/2)
!      END DO
      STOP
 101  FORMAT(12F9.3)
        WRITE(*,101) ((A(I,J),J=1,N/2),I=1,N/2)
      END

