# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
module mshelicon
! Multi-scale convolution
  use adj_mod
  use mshelix
  use helicon
  implicit none
  integer, private :: nx
  integer, private :: ns
  type( msfilter), private :: msaa
  contains
  subroutine mshelicon_init ( nx_in,ns_in,msaa_in )
    integer :: nx_in
    integer :: ns_in
    type( msfilter) :: msaa_in
    nx = nx_in
    ns = ns_in
    msaa = msaa_in
  end subroutine
  function mshelicon_lop ( adj, add, xx, yy) result(stat)
    integer :: stat
    logical,intent(in) :: adj,add
    real,dimension(:) :: xx,yy
    call adjnull (adj,add,xx,yy )
    call mshelicon_lop2(adj,add,xx,yy )
    stat=0
  end function
  subroutine mshelicon_lop2(adj,add,xx,yy)
    logical,intent(in) :: adj,add
    real, dimension ( nx) :: xx
    real, dimension ( nx, ns) :: yy
    integer :: is, stat1
    type (filter) :: aa
    do is = 1, ns
      call onescale( is, msaa, aa)
      call helicon_init( aa)
      stat1 = helicon_lop( adj, .true., xx, yy(:,is))
    end do
  end subroutine
  subroutine mshelicon_close()
  end subroutine
end module
