ndarray Derived Type

type, public, extends(pf_encap_t) :: ndarray

N-dimensional array type, extends the abstract encap type


Inherits

type~~ndarray~~InheritsGraph type~ndarray ndarray type~pf_encap_t pf_encap_t type~ndarray->type~pf_encap_t

Contents

Source Code


Components

TypeVisibility AttributesNameInitial
integer, public :: dim
integer, public, allocatable:: shape(:)
real(kind=pfdp), public, allocatable:: flatarray(:)

Type-Bound Procedures

procedure, public :: setval => ndarray_setval

  • public subroutine ndarray_setval(this, val, flags)

    The following are the base subroutines that all encapsulations must provide

    Read more…

    Arguments

    Type IntentOptional AttributesName
    class(ndarray), intent(inout) :: this
    real(kind=pfdp), intent(in) :: val
    integer, intent(in), optional :: flags

procedure, public :: copy => ndarray_copy

  • public subroutine ndarray_copy(this, src, flags)

    Subroutine to copy an array

    Arguments

    Type IntentOptional AttributesName
    class(ndarray), intent(inout) :: this
    class(pf_encap_t), intent(in) :: src
    integer, intent(in), optional :: flags

procedure, public :: norm => ndarray_norm

  • public function ndarray_norm(this, flags) result(norm)

    Subroutine to define the norm of the array (here the max norm)

    Arguments

    Type IntentOptional AttributesName
    class(ndarray), intent(in) :: this
    integer, intent(in), optional :: flags

    Return Value real(kind=pfdp)

procedure, public :: pack => ndarray_pack

  • public subroutine ndarray_pack(this, z, flags)

    Subroutine to pack an array into a flat array for sending

    Arguments

    Type IntentOptional AttributesName
    class(ndarray), intent(in) :: this
    real(kind=pfdp), intent(out) :: z(:)
    integer, intent(in), optional :: flags

procedure, public :: unpack => ndarray_unpack

  • public subroutine ndarray_unpack(this, z, flags)

    Subroutine to unpack a flatarray after receiving

    Arguments

    Type IntentOptional AttributesName
    class(ndarray), intent(inout) :: this
    real(kind=pfdp), intent(in) :: z(:)
    integer, intent(in), optional :: flags

procedure, public :: axpy => ndarray_axpy

  • public subroutine ndarray_axpy(this, a, x, flags)

    Subroutine to compute y = a x + y where a is a scalar and x and y are arrays

    Arguments

    Type IntentOptional AttributesName
    class(ndarray), intent(inout) :: this
    real(kind=pfdp), intent(in) :: a
    class(pf_encap_t), intent(in) :: x
    integer, intent(in), optional :: flags

procedure, public :: eprint => ndarray_eprint

  • public subroutine ndarray_eprint(this, flags)

    Subroutine to print the array to the screen (mainly for debugging purposes)

    Arguments

    Type IntentOptional AttributesName
    class(ndarray), intent(inout) :: this
    integer, intent(in), optional :: flags

Source Code

  type, extends(pf_encap_t) :: ndarray
     integer             :: dim
     integer,    allocatable :: shape(:)
     real(pfdp), allocatable :: flatarray(:)
   contains
     procedure :: setval => ndarray_setval
     procedure :: copy => ndarray_copy
     procedure :: norm => ndarray_norm
     procedure :: pack => ndarray_pack
     procedure :: unpack => ndarray_unpack
     procedure :: axpy => ndarray_axpy
     procedure :: eprint => ndarray_eprint
  end type ndarray