t_cubspl Derived Type

type, public :: t_cubspl


Inherits

type~~t_cubspl~~InheritsGraph type~t_cubspl t_cubspl type~sll_c_bsplines sll_c_bsplines type~t_cubspl->type~sll_c_bsplines bspl

Components

Type Visibility Attributes Name Initial
real(kind=wp), public, ALLOCATABLE :: coefs(:)

B-Spline coefficients

real(kind=wp), public, ALLOCATABLE :: knots(:)

knots (=break points with repeated knots at the end)

class(sll_c_bsplines), public, ALLOCATABLE :: bspl

b-spline class


Constructor

public interface t_cubspl

  • public function cubspl_new(x, f, BC, BC_val) result(sf)

    Interpolation of function values f(x_i)=f_i, i=1,n with a cubic spline, given left and right boundary condition types of boundary conditions: 0: not-a-knot 1: f'(x_boundary)=0 2: f''(x_boundary)=0

    Arguments

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

    x positions

    real(kind=wp), intent(in) :: f(:)

    function values at x positions

    integer, intent(in) :: BC(1:2)

    Boundary condition at x(1)/x(n): =0: not-a-knot, =1: first der. =BC_val(1)/BC_val(2), =2: second der. =BC_val(1)/BC_val(2)

    real(kind=wp), intent(in), optional :: BC_val(1:2)

    Boundary value for BC(1:2) >0,

    Return Value type(t_cubspl)

    self


Finalization Procedures

final :: cubspl_free

  • public subroutine cubspl_free(sf)

    finalize the type rProfile

    Arguments

    Type IntentOptional Attributes Name
    type(t_cubspl), intent(inout) :: sf

    self


Type-Bound Procedures

procedure, public :: eval => cubspl_eval

  • public function cubspl_eval(sf, xpos, deriv) result(y)

    evaluate the n-th derivative of the bsplProfile at position s

    Arguments

    Type IntentOptional Attributes Name
    class(t_cubspl), intent(in) :: sf

    self

    real(kind=wp), intent(in) :: xpos(:)

    position

    integer, intent(in) :: deriv

    derivative (=0: no derivative)

    Return Value real(kind=wp), (size(xpos))

procedure, public :: eval_at_rho => cubspl_eval

for testing

  • public function cubspl_eval(sf, xpos, deriv) result(y)

    evaluate the n-th derivative of the bsplProfile at position s

    Arguments

    Type IntentOptional Attributes Name
    class(t_cubspl), intent(in) :: sf

    self

    real(kind=wp), intent(in) :: xpos(:)

    position

    integer, intent(in) :: deriv

    derivative (=0: no derivative)

    Return Value real(kind=wp), (size(xpos))

Source Code

  TYPE :: t_cubspl
    !--------------------------------------------------------------------------------------------------------------------------------
    REAL(wp),ALLOCATABLE  :: coefs(:)   !! B-Spline coefficients
    REAL(wp),ALLOCATABLE  :: knots(:)   !! knots (=break points with repeated knots at the end)
    CLASS(sll_c_bsplines),ALLOCATABLE :: bspl !! b-spline class
    CONTAINS

    PROCEDURE :: eval  => cubspl_eval
    PROCEDURE :: eval_at_rho  => cubspl_eval  !! for testing
    FINAL :: cubspl_free

  END TYPE t_cubspl