# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
module cdoubint
! double integration
  use adj_mod
  use causint
  use chain_mod
  implicit none
  real ,private, dimension (:), allocatable :: tmp
  contains
  subroutine cdoubint_init ( nx )
    integer :: nx
    if (.not. allocated(tmp)) then
      allocate(tmp ( nx))
    end if
  end subroutine
  function cdoubint_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 cdoubint_lop2(adj,add,x,y )
    stat=0
  end function
  subroutine cdoubint_lop2(adj,add,x,y)
    logical,intent(in) :: adj,add
    real, dimension (:) :: x
    real, dimension (:) :: y
    if (adj) then
      call normal (causint_lop, .true., y, x, tmp)
    else
      call normal (causint_lop, .true., x, y, tmp)
    end if
  end subroutine
  subroutine cdoubint_close()
    deallocate( tmp )
  end subroutine
end module
