!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
       Subroutine Bocov2_cube(H,im,jm)
!     ******************************************************************
!c    *                                                                *
!c    *  Boundary Conditions for Height Points on cube                 *
!c    *                                                                *
!c    ******************************************************************
!c----------------------------------------------------------------------
!c-------------------------------------------------------------------
      implicit none

      integer::im,jm
      integer,parameter::nm=6
      REAL    :: H(-5:im+6,-5:jm+6,6)
      INTEGER :: n,nl,nr,i,j,im1,jm1,k

      im1=im-1
      jm1=jm-1

      do k=-5,0
!c-----------------------------------------------------------------------
!c                Lateral Faces                                          
!c-----------------------------------------------------------------------
!c
!c Lateral Conditions
!c
      Do n=1,4
        nl=n-1+4*((5-n)/4)
        nr=n+1-4*(n/4)
         Do j=1,jm1
           H(k   ,j,n)=H(im1+k,j,nl)
           H(im-k,j,n)=H(1-k  ,j,nr)
	 End Do
      End Do
!c
!c Lower and Upper Conditions
!c
      Do i=1,im1
        H(i,jm-k,1)=H(i,1-k  ,5)           !     Face 1
        H(i,k   ,1)=H(i,jm1+k,6)           !
        H(i,jm-k,2)=H(im1+k,i ,5)          !     Face 2
        H(i,k   ,2)=H(im1+k,jm-i,6)          !
        H(i,jm-k,3)=H(im-i,jm1+k,5)            !     Face 3
        H(i,k   ,3)=H(im-i,1-k  ,6)        !
        H(i,jm-k,4)=H(1-k,jm-i,5)          !     Face 4
        H(i,k   ,4)=H(1-k,i     ,6)          !
      End Do
!c-----------------------------------------------------------------------
!c                Upper and Lower Faces                                  
!c-----------------------------------------------------------------------
!c
!c Lateral Conditions
!c
      Do j=1,jm1
        H(k   ,j,5)=H(im-j,jm1+k,4)        !     Face 5
        H(im-k,j,5)=H(j     ,jm1+k,2)        !
        H(k   ,j,6)=H(j     ,1-k,4)          !     Face 6
        H(im-k,j,6)=H(im-j,1-k,2)          !
      End Do
!c
!c Lower and Upper Conditions
!c
      Do i=1,im1
        H(i,jm-k,5)=H(im-i,jm1+k,3)        !     Face 5
        H(i,k   ,5)=H(i     ,jm1+k,1)        !
        H(i,jm-k,6)=H(i     ,1-k,1)          !     Face 6
        H(i,k   ,6)=H(im-i,1-k,3)          !
      End Do
      enddo
!c-----------------------------------------------------------------------
      END SUBROUTINE Bocov2_cube

