       subroutine padr3d ( arr, idim, jdim, kdim, ndim, imin, imax
     1                   , jmin, jmax, kmin, kmax )
c
c    dac:zeus3d.padr3d <---------------------------- pads real 3-D array
c                                                              may, 1992
c
c    written by: David Clarke
c    modified 1:
c
c  PURPOSE: Pads input real 3-D array "arr" with edge values.
c
c  EXTERNALS: [NONE]
c
c-----------------------------------------------------------------------
c
c
c-----------------------------------------------------------------------
c------------------------ IMPLICIT STATEMENTS --------------------------
c-----------------------------------------------------------------------
c
       implicit      none
c
       integer       idim    , jdim    , kdim    , ndim    , imin
     1             , imax    , jmin    , jmax    , kmin    , kmax
     2             , i       , j       , k       , n
c
       real*8        arr     (idim,jdim,kdim,ndim)
c
c-----------------------------------------------------------------------
c
       do 190 n=1,ndim
         do 30 i=1,imin-1
           do 20 k=kmin,kmax
             do 10 j=jmin,jmax
               arr(i,j,k,n) = arr(imin,j,k,n)
10           continue
20         continue
30       continue
         do 60 i=imax+1,idim
           do 50 k=kmin,kmax
             do 40 j=jmin,jmax
               arr(i,j,k,n) = arr(imax,j,k,n)
40           continue
50         continue
60       continue
         do 90 j=1,jmin-1
           do 80 i=1,idim
             do 70 k=kmin,kmax
               arr(i,j,k,n) = arr(i,jmin,k,n)
70           continue
80         continue
90       continue
         do 120 j=jmax+1,jdim
           do 110 i=1,idim
             do 100 k=kmin,kmax
               arr(i,j,k,n) = arr(i,jmax,k,n)
100          continue
110        continue
120      continue
         do 150 k=1,kmin-1
           do 140 j=1,jdim
             do 130 i=1,idim
               arr(i,j,k,n) = arr(i,j,kmin,n)
130          continue
140        continue
150      continue
         do 180 k=kmax+1,kdim
           do 170 j=1,jdim
             do 160 i=1,idim
               arr(i,j,k,n) = arr(i,j,kmax,n)
160          continue
170        continue
180      continue
190    continue
c
       return
       end
