!---------------------------------------------
! One-way wave-equation shot-profile migration
!---------------------------------------------
! Author : Yaxun Tang
! Version: 2.0
! Date   : Jan. 1, 2008
program main
  use wem_shpmig_complex_mod
  implicit none

  type(dat_grid) :: dgrid
  type(img_grid) :: igrid
  type(wem_ftag) :: ftag_ 
  logical        :: adj, add 
  integer        :: stat

  call sep_init(SOURCE)
  call getch_add_string("head=/dev/null")
  call getch_add_string("noheader=y")
  call set_no_putch()
  call sep_begin_prog()

  call from_param("adj", adj, .true. )
  call from_param("add", add, .false.)


  if (adj) then
     write(0,*)"**********************************"
     write(0,*) "     Shot-profile migration      "
     write(0,*)"**********************************"  
  else
     write(0,*)"**********************************"
     write(0,*)"     Shot-profile demigration     "
     write(0,*)"**********************************"
  end if

  stat = wem_shpmig_init(adj, dgrid, igrid, ftag_)

  stat = wem_shpmig_oper(adj, add, ftag_%imag_, ftag_%crec_)

  stat = wem_shpmig_clos()

  write(0,*)"***********************"
  write(0,*)"      Finished!!!      "
  write(0,*)"***********************"

  call sep_end_prog()

  call exit()

end program
