module wei_type
  !! WEI type definitions
  use wei_util

  !---------------
  implicit none

  !----------------------------------------------------------------
  type weslow
     character(len=128) :: tag
     character(len=128) :: from
     integer            :: bites,esize
     logical            :: velocity
     type(axis)         :: amx,amy,az
     
     !! block binary array
     complex, dimension(:,:,:),     pointer :: bin !slowness (mx,my,z)

  end type weslow
  !----------------------------------------------------------------
  !----------------------------------------------------------------
  type wedata
     character(len=128) :: tag
     character(len=128) :: from
     integer            :: bites
     type(axis)         :: amx,amy,ahx,ahy,aw

     !! block binary array
     complex, dimension(:,:,:,:,:), pointer :: bin
  end type wedata
  !----------------------------------------------------------------
  !----------------------------------------------------------------  
  type weimag
     character(len=128) :: tag
     character(len=128) :: from
     integer            :: bites
     type(axis)         :: amx,amy,ahx,ahy,apx,apy,az

     !! block binary array
     complex, dimension(:,:,:,:,:), pointer :: bin
  end type weimag
  !----------------------------------------------------------------
  !----------------------------------------------------------------
  type wewfld
     character(len=128) :: tag
     character(len=128) :: from
     integer            :: bites
     type(axis)         :: amx,amy,ahx,ahy,aw,az
  end type wewfld
  !----------------------------------------------------------------


  !----------------------------------------------------------------
  type wekmap
     real,    dimension(:),         pointer :: kmx,kmy,khx,khy
     real,    dimension(:,:),       pointer :: ksx,ksy,krx,kry !! f(m,h)
  end type wekmap
  !----------------------------------------------------------------
  !----------------------------------------------------------------
  type wexmap
     real,    dimension(:),         pointer :: mx,my,hx,hy
     real,    dimension(:,:),       pointer :: sx,sy,rx,ry
  end type wexmap
  !----------------------------------------------------------------
  !----------------------------------------------------------------
  type weslowmap
     real,    dimension(:,      :), pointer :: rs_s,rs_r !! f(z,nfk) ->    ref slo
     integer, dimension(:        ), pointer :: nr_s,nr_r !! f(z)     -> no ref slo
     integer, dimension(:,:,:,:,:), pointer :: si_s,si_r !! f(mx,my,hx,hy,z)
     real,    dimension(:,:,:,:,:), pointer :: ss_s,ss_r !! f(mx,my,hx,hy,z)
     real,    dimension(:,:,:,:,:), pointer :: sw_s,sw_r !! f(mx,my,hx,hy,z)
  end type weslowmap
  !----------------------------------------------------------------
  type wedslomap
     complex, dimension(:,:,:,:,:), pointer :: ds_s,ds_r !! f(mx,my,hx,hy,z)
  end type wedslomap
  !----------------------------------------------------------------
  type wecomp
     integer :: sig !! component: 
     !! source  =-1 for ks = km - kh 
     !! receiver=+1 for kr = km + kh

     !! reference slowness
     real,    dimension(:,:),       pointer :: rs !!    ref slo
     integer, dimension(:),         pointer :: nr !! no ref slo
     integer, dimension(:,:,:,:,:), pointer :: si !! slo interp map
     real,    dimension(:,:,:,:,:), pointer :: ss !! slo        map
     real,    dimension(:,:,:,:,:), pointer :: sw !! slo interp weight
     !! spatial wavenumners
     real,    dimension(:,:),       pointer :: kx,ky
  end type wecomp
  !----------------------------------------------------------------  
end module wei_type
