flat_nd_data_class Module

Houses flattened data represenation with multidimensional indexing


Used by


Interfaces

interface

  • private pure module function getDims(this) result(dims)

    Return shape of data stored

    Arguments

    Type IntentOptional Attributes Name
    class(FlatNDData), intent(in) :: this

    Return Value integer(kind=ik), allocatable, dimension(:)

interface

  • private pure module function getValue(this, indexSet) result(val)

    Return multidimensional value for given indexSet (should match array dimension)

    Arguments

    Type IntentOptional Attributes Name
    class(FlatNDData), intent(in) :: this
    integer(kind=ik), intent(in), dimension(:) :: indexSet

    Return Value real(kind=rk)

interface

  • private pure module function get1DSlice(this, indexSet, sliceIndex) result(val)

    Return 1D slice of data at dimension given by sliceIndex and with the other indices set to indexSet

    Arguments

    Type IntentOptional Attributes Name
    class(FlatNDData), intent(in) :: this
    integer(kind=ik), intent(in), dimension(:) :: indexSet
    integer(kind=ik), intent(in) :: sliceIndex

    Return Value real(kind=rk), allocatable, dimension(:)

interface

  • private pure module function get1DSliceIndices(this, indexSet, sliceIndex) result(val)

    Return 1D slice indices of data at dimension given by sliceIndex and with the other indices set to indexSet

    Arguments

    Type IntentOptional Attributes Name
    class(FlatNDData), intent(in) :: this
    integer(kind=ik), intent(in), dimension(:) :: indexSet
    integer(kind=ik), intent(in) :: sliceIndex

    Return Value integer(kind=ik), allocatable, dimension(:)

interface

  • private pure module subroutine initFlatNDData(this, array)

    Initializes the data based on a deferred rank input array

    Arguments

    Type IntentOptional Attributes Name
    class(FlatNDData), intent(inout) :: this
    real(kind=rk), intent(in), dimension(..) :: array

interface

  • private pure module subroutine directInit(this, array, dims)

    Initializes the data based on an already flat array. Requires dimensions/shape to be explicitly passed

    Arguments

    Type IntentOptional Attributes Name
    class(FlatNDData), intent(inout) :: this
    real(kind=rk), intent(in), dimension(:) :: array
    integer(kind=ik), intent(in), dimension(:) :: dims

Derived Types

type, public, extends(Object) ::  FlatNDData

Flat representation of multidimensional data allowing for multidimensional indexing using vector notation - i.e. dataObj%getValue([1,2,3]) = someData(1,2,3). Allows for dimensionality agnostic implementations of various algorithms.

Components

Type Visibility Attributes Name Initial
logical, public :: userDefined = .false.

True only if user explicitly sets it to true

integer(kind=ik), private, allocatable, dimension(:) :: dims

Dimension sizes of each dimension

real(kind=rk), public, allocatable, dimension(:) :: data

Flattened data array (in Fortran order!)

Type-Bound Procedures

procedure, public :: isDefined => isDefinedObject
procedure, public :: makeDefined => makeDefinedObject
procedure, public :: makeUndefined => makeUndefinedObject
procedure, public :: getValue
procedure, public :: get1DSlice
procedure, public :: get1DSliceIndices
procedure, public :: getDims
procedure, public :: init => initFlatNDData
procedure, public :: directInit