periodic_spline Derived Type

type, public :: periodic_spline

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


Contents

Source Code


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

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)


Type-Bound Procedures

procedure, public, :: interpolate => periodic_spline_interp

  • 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

procedure, public, :: derivative => periodic_spline_deriv

  • 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

Source Code

  type :: periodic_spline
     private
     !> Length of the data arrays represented by the spline
     integer :: n = 0
     !> The actual size of the periodic domain
     real :: period = 0
     !> 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, dimension (:), allocatable :: x, y, y2
     !> Indicates if the spline corresponding to this data is valid
     !> and can be used with the spline evaluation routines.
     logical, public :: valid = .false.
     !> 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.
     real :: tension = 1.0
   contains
     procedure :: interpolate => periodic_spline_interp
     procedure :: derivative => periodic_spline_deriv
  end type periodic_spline