program OCsimple
  use sep
  use oc_global_mod
  use oc_file_mod
  use oc_dottest_mod
  use oc_cgstep_mod
  use oc_solver_mod
  use oc_laplacian_mod
  implicit none

  logical :: verb
  character(len=128) :: x_,yy_,t_, name
  integer :: maxmem, stat, niter, nf, operation
  type(fileinfo) :: file
  type(cfilter) :: aa
  real :: eps
  call sep_init()
  call from_param("operation",operation,0)
  call from_param("maxmem",maxmem)
  call from_param("verb",verb,.false.)
  call from_param("nf",nf,5)
  call from_param("niter",niter,10)
  call from_param("eps",eps,1.0)
  x_= "model"; call auxinout(x_ )
  yy_="data" ; call auxinout(yy_)
  name="test.H"; t_=oc_clone(F, x_,name,maxmem)
  call sep_close()
  !! operator init
  call oc_allocatefile(file, x_, maxmem)
  call oc_infofile(file)
  do while(2*nf+1 > file%n(1))
     nf=nf-1
  end do
  call oc_deallocatefile(file)
  call oc_laplacian_init(x_,nf,10,0.0,maxmem)
  select case(operation)
    case(0) !! dot product test
      call oc_dottest_init(maxmem=maxmem)
      call oc_dottest(oc_laplacian, x_,yy_)
    case(1) !! simple forward operator
      stat = oc_laplacian(F,F,x_,yy_)
    case(2) !! inversion
      call oc_solver_init(niter,maxmem,verb)
      call oc_solver(oc_laplacian,oc_cgstep,x_,yy_)
    case default
      call seperr("missing operation")
  end select
  call exit (0)
end program OCsimple
