      subroutine bocohsub_cube(hh,im,jm)

      implicit none
      integer::im,jm,i,j,n,i1,j1
      integer,parameter::nm=6
      real,dimension(0:im+1,0:jm+1,nm,4)::hh
      real,dimension(0:2*im,0:2*jm,nm)::hhv

      do n=1,nm
      do i=1,im
      do j=1,jm
       i1=2*i-1
       j1=2*j-1
       hhv(i1-1,j1-1,n)=hh(i,j,n,4)
       hhv(i1,j1-1,n)=hh(i,j,n,1)
       hhv(i1-1,j1,n)=hh(i,j,n,2)
       hhv(i1,j1,n)=hh(i,j,n,3)
      enddo
      enddo
      enddo

      call bocov1_cube(hhv,2*im-1,2*jm-1)

      do n=1,nm
      do i=1,im
      do j=1,jm
       i1=2*i-1
       j1=2*j-1
       hh(i,j,n,4)=hhv(i1-1,j1-1,n)
       hh(i,j,n,1)=hhv(i1,j1-1,n)
       hh(i,j,n,2)=hhv(i1-1,j1,n)
       hh(i,j,n,3)=hhv(i1,j1,n)
      enddo
      enddo
      enddo

      end subroutine bocohsub_cube

