module tomo_inverse_shape_mod
use sep
use sep3d_struct_mod
use tomo_chain_shape_mod
use shaping_solver_mod
use shaping_op_mod
implicit none
logical,private, save :: prec,verb,dot
integer, private, save :: niter
real, private,save :: eps
real, private, save , pointer :: resid(:)

contains

logical function init_solver(slow)
real :: slow(:)

init_solver=.false.

call from_param("eps",eps,1.)
call from_param("niter",niter,50)
call from_param("prec",prec,.true.)
call from_param("dot",dot,.false.)
call from_param("verb",verb,.false.)
init_solver=.true.
end function



logical function run_solver(data,model)
real :: model(:),data(:)
real,allocatable :: dm(:),junk(:),junk2(:)
integer :: ierr
call shaping_solver(model,data,op,shaping_op,niter,size(model),eps,m0=model)
run_solver=.true.
end function


end module
