Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/fitpack.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module fitpack

public :: fitpack_surface
public :: fitpack_grid_surface
public :: fitpack_grid_result
public :: fitpack_parametric_surface


Expand Down
34 changes: 31 additions & 3 deletions src/fitpack_core.f90
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module fitpack_core
public :: bispev ! * Evaluation of a bivariate spline function
public :: parder ! Partial derivatives of a bivariate spline
public :: pardeu ! Partial derivatives of a bivariate spline
public :: pardtc ! Create partial derivative splane of a bivariate spline
public :: pardtc ! Create partial derivative spline of a bivariate spline
public :: dblint ! Integration of a bivariate spline
public :: profil ! Cross-section of a bivariate spline
public :: evapol ! * Evaluation of a polar spline
Expand All @@ -78,6 +78,7 @@ module fitpack_core
public :: fitpack_argsort
public :: fitpack_error_handling
public :: get_smoothing
public :: resize_if_less_than

! Spline behavior for points not in the support
integer(FP_FLAG), parameter, public :: OUTSIDE_EXTRAPOLATE = 0 ! extrapolated from the end spans
Expand Down Expand Up @@ -162,13 +163,40 @@ pure real(FP_REAL) function fitpack_polar_boundary(theta) result(rad)
end function fitpack_polar_boundary
end interface

interface resize_if_less_than
module procedure resize_if_less_than_double
module procedure resize_if_less_than_integer
end interface

interface fitpack_swap
module procedure swap_data
module procedure swap_size
end interface fitpack_swap

contains

! routines to get enough working space
! for real and integers
subroutine resize_if_less_than_double(v, n)
real(FP_REAL), allocatable, intent(inout) :: v(:)
integer(FP_SIZE), intent(in) :: n
if (allocated(v)) then
if (size(v) >= n) return
deallocate(v)
endif
allocate(v(n))
end subroutine

subroutine resize_if_less_than_integer(v, n)
integer(FP_SIZE), allocatable, intent(inout) :: v(:)
integer(FP_SIZE), intent(in) :: n
if (allocated(v)) then
if (size(v) >= n) return
deallocate(v)
endif
allocate(v(n))
end subroutine

! Flow control: on output flag present, return it;
! otherwise, halt on error
subroutine fitpack_error_handling(ierr,ierr_out,whereAt)
Expand Down Expand Up @@ -2609,7 +2637,7 @@ pure subroutine fpbisp(tx,nx,ty,ny,c,kx,ky,x,mx,y,my,z,wx,wy,lx,ly)
! ..local variables..
integer(FP_SIZE) :: kx1,ky1,l,l1,m,nkx1,nky1,i,i1,j
real(FP_REAL) :: arg,sp,tb,te,h(MAX_ORDER+1)

! X
kx1 = kx+1
nkx1 = nx-kx1
Expand Down Expand Up @@ -15500,7 +15528,7 @@ pure subroutine percur(iopt,m,x,y,w,k,s,nest,n,t,c,fp,wrk,lwrk,iwrk,ier)
end subroutine percur


subroutine pogrid(iopt,ider,mu,u,mv,v,z,z0,r,s, &
pure subroutine pogrid(iopt,ider,mu,u,mv,v,z,z0,r,s, &
nuest,nvest,nu,tu,nv,tv,c,fp,wrk,lwrk,iwrk,kwrk,ier)

! subroutine pogrid fits a function f(x,y) to a set of data points
Expand Down
Loading