new_spline Function

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

Uses

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)


Contents

Source Code


Source Code

  type(spline) function new_spline (x, y, tension) result(spl)
    use optionals, only: get_option_with_default
    implicit none
    real, dimension (:), intent (in) :: x, y
    real, intent(in), optional :: tension
    real, dimension(:), allocatable :: temp
    integer :: ierr
    spl%valid = .false.
    spl%tension = get_option_with_default(tension, 1.0)
    spl%n = size(x)
    allocate(spl%x, source = x) ; allocate(spl%y, source = y)
    allocate (spl%y2(spl%n), temp(spl%n))
    call fitp_curv1 (spl%n, spl%x, spl%y, 0.0, 0.0, 3, spl%y2, temp, spl%tension, ierr)
    spl%valid = ierr == 0
  end function new_spline