finter Function

function finter(func, x)

Arguments

Type IntentOptional Attributes Name
type(finter_type) :: func
real(kind=8) :: x

Return Value real(kind=8)


Calls

proc~~finter~~CallsGraph proc~finter finter f f proc~finter->f locate locate proc~finter->locate polint polint proc~finter->polint x x proc~finter->x

Source Code

function finter(func,x)
  real(8)           :: x
  type(finter_type) :: func
  real(8)           :: finter
  real(8)           :: y,dy
  integer           :: j,k,k0,k1
  integer           :: n
  N=func%N    !order of polynomial interpolation
  finter=0.d0
  j=locate(func%X(func%Imin:func%Imax),x)
  !k = min(max(j-(N-1)/2,1),func%Imax+1-N)
  k=max(j-(N-1)/2,1)
  k0=k
  if(k0 < func%Imin)k0=func%Imin
  k1=k+N+1
  if(k1 > func%Imax)then
     k1=func%Imax
     k0=k1-N-1
  endif
  call polint(func%X(k0:k1),func%F(k0:k1),x,y,dy)
  !call polint(func%X(k:k+n),func%F(k:k+n),x,y,dy)
  finter=y
  return
end function finter