module nhelix_mod
! Define nonstationary filter type
	use helix_mod
implicit none
	type nfilter	! nd is data length.
		logical, dimension(:), pointer :: mis ! (nd) boundary conditions
		integer, dimension(:), pointer :: pch ! (nd) patches
		type( filter), dimension(:), pointer :: hlx ! (np) filters
	end type
  contains
! allocate a filter
  subroutine nallocate( aa, nh, pch)
	type( nfilter) :: aa
	integer, dimension(:), intent( in) :: nh, pch
	integer :: ip, np, nd
	np = size( nh)
	allocate( aa%hlx( np))
	do ip = 1, np
		call allocatehelix( aa%hlx( ip), nh( ip))
	end do
	nd = size( pch)
	allocate( aa%pch( nd))
	aa%pch = pch
	nullify( aa%mis) ! set null pointer for mis.
  end subroutine
! destroy a filter
  subroutine ndeallocate( aa)
	type( nfilter) :: aa
	integer :: ip
	do ip = 1, size( aa%hlx)
		call deallocatehelix( aa%hlx( ip))
	end do
	deallocate( aa%hlx, aa%pch)
	if ( associated( aa%mis)) then ! if logicals were allocated
		deallocate( aa%mis) ! free them
	end if
  end subroutine
end module
