module invint2  
! Inverse linear interpolation
  use lint1
  use helicon                           
  ! regularized    by helix   filtering
  use polydiv                           
  ! preconditioned by inverse filtering
  use cgstep_mod 
  use solver_reg_mod
  use solver_prc_mod
  implicit none
  contains
  subroutine invint( niter, coord,ord, o1,d1, mm,mmov, eps, aa, method&
    &)
    logical,                  intent( in)  :: method
    integer,                  intent( in)  :: niter
    real,                     intent( in)  :: o1, d1, eps
    real,    dimension( :),   intent( in)  :: ord  
    type( filter),            intent( in)  :: aa
    real,    dimension( :),   intent( out) :: mm             
    real,    dimension( :,:), intent( out) :: mmov         
    ! model movie
    real,    dimension( :),   pointer      :: coord        
    ! coordinate
    call lint1_init( o1, d1, coord)
    if ( method) then
! preconditioning
      call polydiv_init( size(mm), aa)
      call solver_prc( Fop=lint1_lop, stepper=cgstep, niter=niter, m=mm&
        &, d=ord,Sop=polydiv_lop, nSop=size(mm), eps=eps, mmov=mmov,&
        & verb=.true.)
      call polydiv_close()
    else
! regularization
      call helicon_init( aa)
      call solver_reg( Fop=lint1_lop, stepper=cgstep, niter=niter, m=mm&
        &, d=ord,Aop=helicon_lop, nAop=size(mm), eps=eps, mmov=mmov,&
        & verb=.true.)
    end if 
    call cgstep_close()
  end subroutine 
end module 
