!! --------------------------------------------------------
!! rpt2ad1.f90
!!
!! Riemann solver in the transverse direction for the advection equation.
!! --------------------------------------------------------
SUBROUTINE rpt2ad1(ixy,maxm,meqn,mwaves,mbc,mx,&
     & ql,qr,aux1,aux2,aux3,&
     & imp,asdq,bmasdq,bpasdq)
  IMPLICIT REAL(a-h,o-z)

  INTEGER :: i1,i,ixy,maxm,meqn,mwaves,mbc,imp,mx
  REAL, DIMENSION(1-mbc:maxm+mbc,meqn) :: qr,ql,asdq,bmasdq,bpasdq
  REAL, DIMENSION(1-mbc:maxm+mbc,2) :: aux1,aux2,aux3
  REAL :: kv

  kv = 3-ixy  !#  = 1 if ixy=2  or  = 2 if ixy=1
  DO  i = 2-mbc,mx+mbc
     i1 = i-2+imp    !#  =  i-1 for amdq,  i for apdq
     bmasdq(i,1) = MIN(aux2(i1,kv), 0.d0) * asdq(i,1)
     bpasdq(i,1) = MAX(aux3(i1,kv), 0.d0) * asdq(i,1)
  END DO

  RETURN
END SUBROUTINE rpt2ad1
