# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"

module regrid
! convert a helix filter from one size data to another
  use helix
  use cartesian
  implicit none
  contains
  subroutine regridn( nold, nnew, aa)
    integer, dimension (:), intent (in) :: nold, nnew
    ! old and new helix grid
    type( filter) :: aa
    integer, dimension( size( nold)) :: ii
    integer :: i, h0, h1, h
    call cart2line( nold, nold/2, h0)
    ! lag of any near middle point on nold
    call cart2line( nnew, nold/2, h1)
    ! lag on nnew
    do i = 1, size( aa%lag)
! forall given filter coefficients
      h = aa%lag( i) + h0 ! what is this?
      call line2cart( nold, h, ii) !
      call cart2line( nnew, ii, h) !
      aa%lag( i) = h - h1 ! what is this
    end do
  end subroutine
end module
