piecewise2D Derived Type

type, public, extends(piecewise) :: piecewise2D

2D piecewise type. Used for images


Components

Type Visibility Attributes Name Initial
real(kind=wp), public, allocatable :: cdf(:)

cumulative distribution function (CDF) of array.

real(kind=wp), public :: cell_height

Height of each cell

real(kind=wp), public :: cell_width

Width of each cell

integer, private :: xoffset

Offsets

integer, private :: yoffset

Offsets


Constructor

public interface piecewise2D

  • public function init_piecewise2D(cell_width, cell_height, image)

    Initalise the piecewise2D type with a given cell_width, cell_height and input image

    Arguments

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

    Input cell width

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

    Input cell height

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

    Input image

    Return Value type(piecewise2D)


Type-Bound Procedures

procedure, public :: sample => sample2D

Overloaded sampling function

  • public subroutine sample2D(this, x, y, value)

    Arguments

    Type IntentOptional Attributes Name
    class(piecewise2D), intent(in) :: this
    real(kind=wp), intent(out) :: x
    real(kind=wp), intent(out) :: y
    real(kind=wp), intent(in), optional :: value

Source Code

    type, extends(piecewise) :: piecewise2D
        !> Height of each cell
        real(kind=wp) :: cell_height
        !> Width of each cell
        real(kind=wp) :: cell_width
        !>cumulative distribution function (CDF) of array.
        real(kind=wp), allocatable :: cdf(:)
        !> Offsets
        integer, private :: xoffset, yoffset
        contains
            !> Overloaded sampling function
            procedure :: sample => sample2D
    end type piecewise2D