splines Module

FIXME : Add documentation



Contents


Interfaces

private interface handle_spline_error

  • private subroutine handle_spline_error_logical(valid, routine_name)

    If not valid abort with error noting invalid spline and which method was invoked

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(in) :: valid
    character(len=*), intent(in) :: routine_name

public interface spline

Constructor for spline

  • public function new_spline(x, y, tension) result(spl)

    Populates a spline instance spl representing the non-periodic data y(x).

    Arguments

    Type IntentOptional Attributes Name
    real, intent(in), dimension (:) :: x
    real, intent(in), dimension (:) :: y
    real, intent(in), optional :: tension

    Return Value type(spline)

public interface periodic_spline

Constructor for periodic_spline

  • public function new_periodic_spline(x, y, period, drop_last_point, tension) result(spl)

    Populates a periodic_spline instance spl representing the periodic data y(x) of length n and periodic on period. Note that the spline library expects period > x(n) - x(1), which means the input data shouldn't include the duplicate periodic point. As a convenience the user can pass data with the duplicate point and set drop_last_point = .true. to automatically exclude the duplicate point.

    Arguments

    Type IntentOptional Attributes Name
    real, intent(in), dimension (:) :: x
    real, intent(in), dimension (:) :: y
    real, intent(in) :: period
    logical, intent(in), optional :: drop_last_point
    real, intent(in), optional :: tension

    Return Value type(periodic_spline)


Derived Types

type, public ::  spline

Holds data representing a non-periodic spline. Should be set up by calling new_spline.

Components

Type Visibility Attributes Name Initial
integer, private :: n = 0

Length of the data arrays represented by the spline

real, private, dimension (:), allocatable :: x

Holds the independent and dependent values of the splined data in x and y. The second derivative is held in y2 and calculated automatically.

real, private, dimension (:), allocatable :: y

Holds the independent and dependent values of the splined data in x and y. The second derivative is held in y2 and calculated automatically.

real, private, dimension (:), allocatable :: y2

Holds the independent and dependent values of the splined data in x and y. The second derivative is held in y2 and calculated automatically.

logical, public :: valid = .false.

Indicates if the spline corresponding to this data is valid and can be used with the spline evaluation routines.

real, private :: tension = 1.0

The tension used in computing the splined data, note this must be the value used in the initialisation when passed to the spline evaluation routines.

Constructor

Constructor for spline

public function new_spline (x, y, tension)

Populates a spline instance spl representing the non-periodic data y(x).

Type-Bound Procedures

procedure , public , :: interpolate => spline_interp Function
procedure , public , :: derivative => spline_deriv Function

type, public ::  periodic_spline

Holds data representing a periodic spline. Should be set up by calling new_periodic_spline.

Components

Type Visibility Attributes Name Initial
integer, private :: n = 0

Length of the data arrays represented by the spline

real, private :: period = 0

The actual size of the periodic domain

real, private, dimension (:), allocatable :: x

Holds the independent and dependent values of the splined data in x and y. The second derivative is held in y2 and calculated automatically.

real, private, dimension (:), allocatable :: y

Holds the independent and dependent values of the splined data in x and y. The second derivative is held in y2 and calculated automatically.

real, private, dimension (:), allocatable :: y2

Holds the independent and dependent values of the splined data in x and y. The second derivative is held in y2 and calculated automatically.

logical, public :: valid = .false.

Indicates if the spline corresponding to this data is valid and can be used with the spline evaluation routines.

real, private :: tension = 1.0

The tension used in computing the splined data, note this must be the value used in the initialisation when passed to the spline evaluation routines.

Constructor

Constructor for periodic_spline

public function new_periodic_spline (x, y, period, drop_last_point, tension)

Populates a periodic_spline instance spl representing the periodic data y(x) of length n and periodic on period. Note that the spline library expects period > x(n) - x(1), which means the input data shouldn't include the duplicate periodic point. As a convenience the user can pass data with the duplicate point and set drop_last_point = .true. to automatically exclude the duplicate point.

Type-Bound Procedures

procedure , public , :: interpolate => periodic_spline_interp Function
procedure , public , :: derivative => periodic_spline_deriv Function

Functions

public function new_spline(x, y, tension) result(spl)

Populates a spline instance spl representing the non-periodic data y(x).

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension (:) :: x
real, intent(in), dimension (:) :: y
real, intent(in), optional :: tension

Return Value type(spline)

public function new_periodic_spline(x, y, period, drop_last_point, tension) result(spl)

Populates a periodic_spline instance spl representing the periodic data y(x) of length n and periodic on period. Note that the spline library expects period > x(n) - x(1), which means the input data shouldn't include the duplicate periodic point. As a convenience the user can pass data with the duplicate point and set drop_last_point = .true. to automatically exclude the duplicate point.

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension (:) :: x
real, intent(in), dimension (:) :: y
real, intent(in) :: period
logical, intent(in), optional :: drop_last_point
real, intent(in), optional :: tension

Return Value type(periodic_spline)

private function spline_interp(self, x)

Bound wrapper to splint

Arguments

Type IntentOptional Attributes Name
class(spline), intent(in) :: self
real, intent(in) :: x

Return Value real

private function spline_deriv(self, x)

Bound wrapper to dsplint

Arguments

Type IntentOptional Attributes Name
class(spline), intent(in) :: self
real, intent(in) :: x

Return Value real

public function splint(x, spl)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x
type(spline), intent(in) :: spl

Return Value real

private function periodic_spline_interp(self, x)

Bound wrapper to splint

Arguments

Type IntentOptional Attributes Name
class(periodic_spline), intent(in) :: self
real, intent(in) :: x

Return Value real

private function periodic_spline_deriv(self, x)

Bound wrapper to dsplint

Arguments

Type IntentOptional Attributes Name
class(periodic_spline), intent(in) :: self
real, intent(in) :: x

Return Value real

public function periodic_splint(x, spl)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x
type(periodic_spline), intent(in) :: spl

Return Value real

public function dsplint(x, spl)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x
type(spline), intent(in) :: spl

Return Value real

public function periodic_dsplint(x, spl)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x
type(periodic_spline), intent(in) :: spl

Return Value real

private function splintint(x0, x1, spl)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x0
real, intent(in) :: x1
type(spline), intent(in) :: spl

Return Value real

private function periodic_splintint(x0, x1, spl)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x0
real, intent(in) :: x1
type(periodic_spline), intent(in) :: spl

Return Value real

public function fitp_curv2(t, n, x, y, yp, sigma)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: t
integer, intent(in) :: n
real, intent(in), dimension(n) :: x
real, intent(in), dimension(n) :: y
real, intent(in), dimension(n) :: yp
real, intent(in) :: sigma

Return Value real

public function fitp_curvd(t, n, x, y, yp, sigma)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: t
integer, intent(in) :: n
real, intent(in), dimension(n) :: x
real, intent(in), dimension(n) :: y
real, intent(in), dimension(n) :: yp
real, intent(in) :: sigma

Return Value real

private function fitp_curvi(xl, xu, n, x, y, yp, sigma)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: xl
real, intent(in) :: xu
integer, intent(in) :: n
real, intent(in), dimension(n) :: x
real, intent(in), dimension(n) :: y
real, intent(in), dimension(n) :: yp
real, intent(in) :: sigma

Return Value real

public function fitp_curvp2(t, n, x, y, p, yp, sigma)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: t
integer, intent(in) :: n
real, intent(in), dimension(:) :: x
real, intent(in), dimension(:) :: y
real, intent(in) :: p
real, intent(in), dimension(:) :: yp
real, intent(in) :: sigma

Return Value real

private function fitp_curvpd(t, n, x, y, p, yp, sigma)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: t
integer, intent(in) :: n
real, intent(in), dimension(:) :: x
real, intent(in), dimension(:) :: y
real, intent(in) :: p
real, intent(in), dimension(:) :: yp
real, intent(in) :: sigma

Return Value real

private function fitp_curvpi(xl, xu, n, x, y, p, yp, sigma)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: xl
real, intent(in) :: xu
integer, intent(in) :: n
real, intent(in), dimension(n) :: x
real, intent(in), dimension(n) :: y
real, intent(in) :: p
real, intent(in), dimension(n) :: yp
real, intent(in) :: sigma

Return Value real

public function fitp_surf2(xx, yy, m, n, x, y, z, iz, zp, sigma)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: xx
real, intent(in) :: yy
integer, intent(in) :: m
integer, intent(in) :: n
real, intent(in), dimension(m) :: x
real, intent(in), dimension(n) :: y
real, intent(in), dimension(iz,n) :: z
integer, intent(in) :: iz
real, intent(in), dimension(m,n,3) :: zp
real, intent(in) :: sigma

Return Value real

private function fitp_intrvl(t, x, n)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: t
real, intent(in), dimension(n) :: x
integer, intent(in) :: n

Return Value integer

private function fitp_intrvp(t, x, n)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: t
real, intent(in), dimension(n) :: x
integer, intent(in) :: n

Return Value integer

private elemental function fitp_periodic_wrap_value(t, x_start, p) result(wrapped_value)

Given a value t, and stating value of abscissae, x, periodic with period p map t to the equivalent value in the range of x (i.e. between x(1) and x(1) + p)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: t
real, intent(in) :: x_start
real, intent(in) :: p

Return Value real

private function fitp_intrv_helper(tt, x, n, periodic) result(index)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: tt
real, intent(in), dimension(n) :: x
integer, intent(in) :: n
logical, intent(in) :: periodic

Return Value integer

private elemental function sinhm_fun(x)

Calculate sinhm(x) = sinh(x) / x - 1

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x

Return Value real

private elemental function coshm_fun(x)

Calculate coshm(x) = cosh(x) - 1

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x

Return Value real

private elemental function coshmm_fun(x)

Calculate coshmm(x) = (cosh(x) - 1 - x * x / 2) / (x * x)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x

Return Value real


Subroutines

public subroutine delete_spline(spl)

Reset and deallocate variables in passed spline

Arguments

Type IntentOptional Attributes Name
type(spline), intent(inout) :: spl

public subroutine delete_periodic_spline(spl)

Reset and deallocate variables in passed periodic spline

Arguments

Type IntentOptional Attributes Name
type(periodic_spline), intent(inout) :: spl

private subroutine handle_spline_error_logical(valid, routine_name)

If not valid abort with error noting invalid spline and which method was invoked

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: valid
character(len=*), intent(in) :: routine_name

public subroutine inter_d_cspl(r, data, x, dint, ddint)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension(:) :: r
real, intent(in), dimension(:) :: data
real, intent(in), dimension(:) :: x
real, intent(out), dimension(:) :: dint
real, intent(out), dimension(:) :: ddint

public subroutine inter_cspl(r, data, x, dint)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension(:) :: r
real, intent(in), dimension(:) :: data
real, intent(in), dimension(:) :: x
real, intent(out), dimension(:) :: dint

public pure subroutine fitp_curv1(n, x, y, slp1, slpn, islpsw, yp, temp, sigma, ierr)

FIXME : Add documentation (or tidyup above)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real, intent(in), dimension(n) :: x
real, intent(in), dimension(n) :: y
real, intent(in) :: slp1
real, intent(in) :: slpn
integer, intent(in) :: islpsw
real, intent(out), dimension(n) :: yp
real, intent(out), dimension(n) :: temp
real, intent(in) :: sigma
integer, intent(out) :: ierr

public pure subroutine fitp_curvp1(n, x, y, p, yp, temp, sigma, ierr)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real, intent(in), dimension(:) :: x
real, intent(in), dimension(:) :: y
real, intent(in) :: p
real, intent(out), dimension(:) :: yp
real, intent(out), dimension(:) :: temp
real, intent(in) :: sigma
integer, intent(out) :: ierr

public pure subroutine fitp_surf1(m, n, x, y, z, iz, zx1, zxm, zy1, zyn, zxy11, zxym1, zxy1n, zxymn, islpsw, zp, temp, sigma, ierr)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: m
integer, intent(in) :: n
real, intent(in), dimension(m) :: x
real, intent(in), dimension(n) :: y
real, intent(in), dimension(iz,n) :: z
integer, intent(in) :: iz
real, intent(in), dimension(n) :: zx1
real, intent(in), dimension(n) :: zxm
real, intent(in), dimension(m) :: zy1
real, intent(in), dimension(m) :: zyn
real, intent(in) :: zxy11
real, intent(in) :: zxym1
real, intent(in) :: zxy1n
real, intent(in) :: zxymn
integer, intent(in) :: islpsw
real, intent(out), dimension(m,n,3) :: zp
real, intent(out), dimension(n+n+m) :: temp
real, intent(in) :: sigma
integer, intent(out) :: ierr

private pure subroutine fitp_ceez(del1, del2, sigma, c1, c2, c3, n)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: del1
real, intent(in) :: del2
real, intent(in) :: sigma
real, intent(out) :: c1
real, intent(out) :: c2
real, intent(out) :: c3
integer, intent(in) :: n

private pure subroutine fitp_terms(diag, sdiag, sigma, del)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(out) :: diag
real, intent(out) :: sdiag
real, intent(in) :: sigma
real, intent(in) :: del