SUBROUTINE Interp1d(ns,s,f,nsi,si,fi)
!
! Cubic spline interpolation for radial profiles
! (not satisfying periodic boundary conditions)
! Given a set of NS data points (s,f), the value of
! the function at the NSI data points SI is returned.
!
! A. Pletzer Nov 2000
!
  use ezspline_obj
  use ezspline
      IMPLICIT NONE
      integer, parameter :: r8 = selected_real_kind(12,100)
 
      integer, intent(in) :: ns
      real(r8), intent(in) :: s(ns)
      real(r8), intent(in) :: f(ns)
      integer, intent(in) :: nsi
      real(r8), intent(in) :: si(nsi)
      real(r8), intent(out) :: fi(nsi)
 
 
      type(ezspline1) :: fspl
      integer :: iok
 
      call ezspline_init(fspl, ns, (/0, 0/), iok)
      call ezspline_error(iok)
 
      fspl % x1 = s
 
      call ezspline_setup(fspl, f, iok)
      call ezspline_error(iok)
 
      call ezspline_interp(fspl, nsi, si, fi, iok)
      call ezspline_error(iok)
 
      call ezspline_free(fspl, iok)
      call ezspline_error(iok)
 
END SUBROUTINE Interp1d
