!
!  cal_vol.f90
!
      subroutine cal_vol(x,y,z,vol,icvs,jcvs,kcvs,rz,iz,dz,cz,ierr)
!
      implicit none
      real :: rz(*)
      integer :: iz(*),ierr
      character :: cz(*)
      real (selected_int_kind (5)) :: dz(*)
!
      integer :: icvs,jcvs,kcvs
      real :: x(icvs,jcvs,kcvs),y(icvs,jcvs,kcvs),z(icvs,jcvs,kcvs), &
              vol(icvs-1,jcvs-1,kcvs-1)
!
      real :: delx,dely,delz
      integer :: i,j,k
!
! Handle i=1,j=1,k=1
      do i=1,icvs-1
      do j=1,jcvs-1
      do k=1,kcvs-1
        delx = x(i+1,j,k) - x(i,j,k)
        dely = y(i,j+1,k) - y(i,j,k)
        delz = z(i,j,k+1) - z(i,j,k)      
        vol(i,j,k) = delx*dely*delz
      enddo
      enddo
      enddo
!
! Handle the rest                           
!
      end subroutine cal_vol