!!.. this module defines all the global variables
!!.. that are shared by all the subroutines and functions
!!------------------------------------------------------------
!!.. Author: Yaxun Tang, tang@sep.stanford.edu
!!------------------------------------------------------------
module wem_glodef_mod
  use  base_struct_mod
  implicit none

  type(dat_grid)                        , save :: dgrid    !!.. receiver grid
  type(vel_grid)                        , save :: vgrid    !!.. velocity grid
  type(pro_grid)                        , save :: pgrid    !!.. propagation grid
  type(img_grid)                        , save :: igrid    !!.. image grid
  type(out_grid)                        , save :: ogrid    !!.. image output grid
  type(hes_grid)                        , save :: hgrid
  
  type(block)                           , save :: zblock
  type(block)                           , save :: wblock

  real   , dimension(:,:,:)    , pointer, save :: vmod     !!.. velocity model
  real   , dimension(:,:)      , pointer, save :: vref     !!.. reference velocity

  real   , dimension(:,:,:)    , pointer, save :: modl     !!.. output image
  real   , dimension(:,:,:)    , pointer, save :: hess     !!.. Hessian
  
  complex, dimension(:,:)      , pointer, save :: crec
  complex, dimension(:,:)      , pointer, save :: csou
  complex, dimension(:,:,:,:)  , pointer, save :: wfds
  complex, dimension(:,:,:,:)  , pointer, save :: wfdr

  character(len=256)                    , save :: csou_
  character(len=256)                    , save :: crec_
  character(len=256)                    , save :: vmod_
  character(len=256)                    , save :: imag_
  character(len=256)                    , save :: hess_

  integer                               , save :: nvrf
  integer                               , save :: pdip
  real                                  , save :: trick
  character(len=5)                      , save :: oper
end module
