ndarray_oc Derived Type

type, public, extends(pf_encap_t) :: ndarray_oc

N-dimensional array type for optimal control, extends the abstract encap type


Inherits

type~~ndarray_oc~~InheritsGraph type~ndarray_oc ndarray_oc type~pf_encap_t pf_encap_t type~ndarray_oc->type~pf_encap_t

Contents

Source Code


Components

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

Type-Bound Procedures

procedure, public :: setval => ndarray_oc_setval

  • public subroutine ndarray_oc_setval(this, val, flags)

    Subroutine to set array to a scalar value.

    Arguments

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

procedure, public :: copy => ndarray_oc_copy

  • public subroutine ndarray_oc_copy(this, src, flags)

    Subroutine to copy an array

    Arguments

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

procedure, public :: norm => ndarray_oc_norm

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

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

    Arguments

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

    Return Value real(kind=pfdp)

procedure, public :: pack => ndarray_oc_pack

  • public subroutine ndarray_oc_pack(this, z, flags)

    Subroutine to pack an array into a flat array for sending

    Arguments

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

procedure, public :: unpack => ndarray_oc_unpack

  • public subroutine ndarray_oc_unpack(this, z, flags)

    Subroutine to unpack a flatarray after receiving

    Arguments

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

procedure, public :: axpy => ndarray_oc_axpy

  • public subroutine ndarray_oc_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_oc), 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_oc_eprint

  • public subroutine ndarray_oc_eprint(this, flags)

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

    Arguments

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

Source Code

  type, extends(pf_encap_t) :: ndarray_oc
     integer                 :: dim
     integer,    allocatable :: shape(:)    
     real(pfdp), allocatable :: yflatarray(:)
     real(pfdp), allocatable :: pflatarray(:) 

   contains
     procedure :: setval => ndarray_oc_setval
     procedure :: copy   => ndarray_oc_copy
     procedure :: norm   => ndarray_oc_norm
     procedure :: pack   => ndarray_oc_pack
     procedure :: unpack => ndarray_oc_unpack
     procedure :: axpy   => ndarray_oc_axpy
     procedure :: eprint => ndarray_oc_eprint
  end type ndarray_oc