program nfilt_it
use sep 
use sep3d_struct_mod
use npolydiv
use nhelicon
use io_nfilt
use cgstep_mod
use mask1
use solver_mod
implicit none
logical :: adj,add,prec
real,allocatable    :: model(:),data(:)
type(sep3d) :: mod,dat
character(len=128) :: label
type(nfilter) :: nfilt
integer :: n,niter
logical, pointer :: mask(:)
real :: eps


call sep_init(SOURCE)
call init_sep3d("in",dat,"INPUT")
call from_param("niter",niter,100)
call from_param("eps",eps,1.)
call auxin("filter")


n=product(dat%n(1:sep3d_ndims(dat)))

if(.not. read_nfilt("filter",nfilt)) &
  call seperr("trouble reading in filter")
write(0,*) "ABB",nfilt%hlx(1)%flt,nfilt%hlx(1)%lag


if(size(nfilt%pch)/=n) call seperr("filter and data size not equiv")

allocate(model(n),data(n),mask(n))
data=0
call sreed("in",data,size(data)*4)
mask=(data/=0.)
call nhelicon_init(nfilt)
call mask1_init(mask)
call solver_reg(mask1_lop,cgstep,nhelicon_lop,n,model,data,niter,eps)
call srite("out",model,size(model)*4)



end program
