!
!  cal_anorm_intf.f90
!
      subroutine cal_anorm_intf(is,ie,js,je,ks,ke,index, &
                                x,y,z,anorm,icvs,jcvs,kcvs,ncs,ierr)
!
      implicit none
      integer :: is,ie,js,je,ks,ke,icvs,jcvs,kcvs,ncs,ierr
      integer :: index(ncs,3)
      real :: x(icvs,jcvs,kcvs),y(icvs,jcvs,kcvs),z(icvs,jcvs,kcvs), &
              anorm(ncs)
!
      real :: delx,dely,delz 
      integer :: i,j,k,n  
!
      do n=1,ncs
        i=index(n,1)
        j=index(n,2)
        k=index(n,3)
        if (is==ie) then
          if (j==jcvs) then
            dely = y(i,j,k) - y(i,j-1,k)
          else
            dely = y(i,j+1,k) - y(i,j,k)
          endif
!          
          if (k==kcvs) then
            delz = z(i,j,k) - z(i,j,k-1)
          else
            delz = z(i,j,k+1) - z(i,j,k) 
          endif
!
          anorm(n) = dely*delz 
        endif
!         
        if (js==je) then
          if (i==icvs) then
            delx = x(i,j,k) - x(i-1,j,k)
          else
            delx = x(i+1,j,k) - x(i,j,k)
          endif
!          
          if (k==kcvs) then
            delz = z(i,j,k) - z(i,j,k-1)
          else
            delz = z(i,j,k+1) - z(i,j,k)
          endif
!
          anorm(n) = delx*delz 
        endif
!         
        if (ks==ke) then
          if (i==icvs) then
            delx = x(i,j,k) - x(i-1,j,k) 
          else
            delx = x(i+1,j,k) - x(i,j,k)
          endif
!          
          if (j==jcvs) then
            dely = y(i,j,k) - y(i,j-1,k)
          else
            dely = y(i,j+1,k) - y(i,j,k)
          endif
!
          anorm(n) = delx*dely           
        endif
      enddo                         
!
      end subroutine cal_anorm_intf