!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
       Subroutine Bocov1_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(0:im+1,0:jm+1,6)
      INTEGER :: n,nl,nr,i,j,im1,jm1

      im1=im-1
      jm1=jm-1
!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(0   ,j,n)=H(im1,j,nl)
           H(im,j,n)=H(1  ,j,nr)
	 End Do
      End Do
!c
!c Lower and Upper Conditions
!c
      Do i=1,im1
        H(i,jm,1)=H(i,1  ,5)             !     Face 1
        H(i,0   ,1)=H(i,jm1,6)             !
        H(i,jm,2)=H(im1,i     ,5)        !     Face 2
        H(i,0   ,2)=H(im1,jm-i,6)        !
        H(i,jm,3)=H(im-i,jm1,5)        !     Face 3
        H(i,0   ,3)=H(im-i,1  ,6)        !
        H(i,jm,4)=H(1,jm-i,5)          !     Face 4
        H(i,0   ,4)=H(1,i     ,6)          !
      End Do
!c-----------------------------------------------------------------------
!c                Upper and Lower Faces                                  
!c-----------------------------------------------------------------------
!c
!c Lateral Conditions
!c
      Do j=1,jm1
        H(0   ,j,5)=H(im-j,jm1,4)        !     Face 5
        H(im,j,5)=H(j     ,jm1,2)        !
        H(0   ,j,6)=H(j     ,1,4)          !     Face 6
        H(im,j,6)=H(im-j,1,2)          !
      End Do
!c
!c Lower and Upper Conditions
!c
      Do i=1,im1
        H(i,jm,5)=H(im-i,jm1,3)        !     Face 5
        H(i,0   ,5)=H(i     ,jm1,1)        !
        H(i,jm,6)=H(i     ,1,1)          !     Face 6
        H(i,0   ,6)=H(im-i,1,3)          !
      End Do
!c-----------------------------------------------------------------------
      END SUBROUTINE Bocov1_cube

