# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
module boxconv
  use adj_mod
  use causint
  use double
  use chain_mod
  implicit none
  real ,private, dimension (:), allocatable :: tmp
  contains
  subroutine boxconv_init ( nbox,ndat )
    integer, intent (in) :: nbox,ndat
    if (.not. allocated(tmp)) then
      allocate(tmp ( ndat+nbox))
    end if
    call double_init (nbox,ndat)
  end subroutine
  function boxconv_lop ( adj, add, x, y) result(stat)
    integer :: stat
    logical,intent(in) :: adj,add
    real,dimension(:) :: x,y
    call adjnull (adj,add,x,y )
    call boxconv_lop2(adj,add,x,y )
    stat=0
  end function
  subroutine boxconv_lop2(adj,add,x,y)
    logical,intent(in) :: adj,add
    real, dimension (:) :: x
    real, dimension (:) :: y
    call chain (causint_lop, double_lop, adj, .true., x, y, tmp)
  end subroutine
  subroutine boxconv_close()
    deallocate( tmp )
  end subroutine
end module
