# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "<stdin>"
module xmap_mod
!! X-domain mapping
  use down_mod

  implicit none
  type(txmap), public :: smap,xmap
contains
!----------------------------------------------------------------
  subroutine xmap_init()
    integer :: er
    real :: a






! dont seem to remember why or when I needed these
    !! mx
    allocate(xmap%mx(down%amx%n),stat=er)
    if(er/=0) call seperr('cant allocate mx')
    !! my
    allocate(xmap%my(down%amy%n),stat=er)
    if(er/=0) call seperr('cant allocate my')
    call xmap_op()
    a=4*size(xmap%mx)+4*size(xmap%my)
    down%mem=down%mem+a






  end subroutine xmap_init
!----------------------------------------------------------------
  subroutine xmap_op()
    integer :: imx,imy
    integer :: er






    !! mx
    do imx=1,down%amx%n
       xmap%mx(imx) = down%amx%o + (imx-1)* down%amx%d
    end do

    !! my
    do imy=1,down%amy%n
       xmap%my(imy) = down%amy%o + (imy-1)* down%amy%d
    end do




  end subroutine xmap_op
  !----------------------------------------------------------------
end module xmap_mod
