hdf5_obj Derived Type

type, public :: hdf5_obj

A utility to read/write files in HDF5


Inherits

type~~hdf5_obj~~InheritsGraph type~hdf5_obj hdf5_obj type~hashtbl_obj hashtbl_obj type~hdf5_obj->type~hashtbl_obj tbl type~parallel_obj parallel_obj type~hdf5_obj->type~parallel_obj parallel type~sllist_obj sllist_obj type~hashtbl_obj->type~sllist_obj vec MPI_Datatype MPI_Datatype type~parallel_obj->MPI_Datatype REAL_SP, REAL_DP, REAL_WP, COMPLEX_SP, COMPLEX_DP, COMPLEX_WP, INTEGER, INT8, LOGICAL MPI_Info MPI_Info type~parallel_obj->MPI_Info mpi_info type~communicators communicators type~parallel_obj->type~communicators comm type~patch patch type~parallel_obj->type~patch rank MPI_Comm MPI_Comm type~communicators->MPI_Comm w, g type~sllist_obj->type~sllist_obj child

Components

Type Visibility Attributes Name Initial
integer(kind=HID_T), public :: fid

File identifier

character(len=:), public, allocatable :: filename

file to read/write

integer(kind=HID_T), public, allocatable :: gid(:)

Group identifier

type(parallel_obj), public, pointer :: parallel => null()

Associated parallel structure

integer, private :: group_count = 0

Number of groups

type(hashtbl_obj), private :: tbl

Hash table


Type-Bound Procedures

procedure, public :: Close => hdf5_obj_Close

  • private impure subroutine hdf5_obj_Close(this)

    Close hdf5 file

    Arguments

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

    A HDF5 object

procedure, public :: CloseGroup => hdf5_obj_CloseGroup

  • private impure subroutine hdf5_obj_CloseGroup(this, groupname)

    Close an HDF5 group

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Group to close

procedure, public :: CreateGroup => hdf5_obj_CreateGroup

  • private impure subroutine hdf5_obj_CreateGroup(this, groupname)

    Create a group (analogous to directory) in an HDF5 file and update hash table

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    File to read/write

procedure, public :: Finalize => hdf5_obj_Final

  • private impure subroutine hdf5_obj_Final(this)

    Finalize the hdf5 object

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

procedure, public :: Initialize => hdf5_obj_Init

  • private impure subroutine hdf5_obj_Init(this, filename, access_flag, parallel)

    Initialize the hdf5 object

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: filename

    File to read/write

    character(len=*), intent(in) :: access_flag

    File access mode

    type(parallel_obj), intent(in), target :: parallel

    parallel structure from main program

procedure, public :: Open => hdf5_obj_Open

  • private impure subroutine hdf5_obj_Open(this, flag)

    Open a hdf5 file

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: flag

    Access mode

procedure, public :: OpenGroup => hdf5_obj_OpenGroup

  • private impure subroutine hdf5_obj_OpenGroup(this, groupname)

    Open a group (analogous to directory) in an HDF5 file and updates hash table

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    File to read/write

generic, public :: Read => hdf5_obj_Read3D, hdf5_obj_Read1D

  • private impure subroutine hdf5_obj_Read3D(this, basegroup, name, array, lo, hi)

    Read a 3D dataset located under basegroup and given by name

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: basegroup

    Parent group containing the dataset

    character(len=*), intent(in) :: name

    Dataset name

    class(*), intent(out) :: array(:,:,:)

    Data array

    integer, intent(in) :: lo(3)

    Low bounds

    integer, intent(in) :: hi(3)

    High bounds

  • private impure subroutine hdf5_obj_Read1D(this, basegroup, name, array)

    Read a 1D dataset located under basegroup and given by name

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: basegroup

    Parent group containing the dataset

    character(len=*), intent(in) :: name

    Dataset name

    class(*), intent(out) :: array(:,:,:)

    Data array

generic, public :: ReadAttributes => hdf5_obj_ReadAttributes0D, hdf5_obj_ReadAttributes1D

  • private impure subroutine hdf5_obj_ReadAttributes0D(this, groupname, label, val)

    Read a scalar attribute under a given group

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: label

    Attribute label

    class(*), intent(out) :: val

    Attribute value

  • private impure subroutine hdf5_obj_ReadAttributes1D(this, groupname, label, val)

    Read a 1-D array of attributes under a given group

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: label

    Attribute label

    class(*), intent(out) :: val(:)

    Attribute values

procedure, public :: ReadCoord => hdf5_obj_ReadCoord

  • private impure subroutine hdf5_obj_ReadCoord(this, groupname, name, Coord)

    Read coordinates from HDF5 file. Only the root MPI rank does the reading, and then broadcasts to other MPI ranks.

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: name

    Variable name

    class(*), intent(out) :: Coord(:)

    1-D Coordinates

procedure, public :: ReadGroupNames => hdf5_obj_ReadGroupNames

  • private impure subroutine hdf5_obj_ReadGroupNames(this, basegroup, names)

    Read the groups (i.e., directories) under a given base group in an HDF5 file.

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: basegroup

    Base group to explore

    character(len=str64), intent(out), allocatable :: names(:)

    Names of groups under the base group

generic, public :: Write => hdf5_obj_Write3D, hdf5_obj_Write1D

  • private impure subroutine hdf5_obj_Write3D(this, groupname, name, array, lo, hi)

    Write Eulerian/3D data to a HDF5 file

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: name

    Variable name

    class(*), intent(in) :: array(:,:,:)

    3-D data array

    integer, intent(in) :: lo(3)

    Low bounds

    integer, intent(in) :: hi(3)

    High bounds

  • private impure subroutine hdf5_obj_Write1D(this, groupname, name, array)

    Write an array/1D data to a HDF5 file.

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: name

    Variable name

    class(*), intent(in) :: array(:)

    1-D data array

generic, public :: WriteAttributes => hdf5_obj_WriteAttributes0D, hdf5_obj_WriteAttributes1D

  • private impure subroutine hdf5_obj_WriteAttributes0D(this, groupname, label, val)

    Write a scalar attribute

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: label

    attribute label

    class(*), intent(in) :: val
  • private impure subroutine hdf5_obj_WriteAttributes1D(this, groupname, label, val)

    Write an array of attributes

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: label

    attribute label

    class(*), intent(in) :: val(:)

procedure, public :: WriteCoord => hdf5_obj_WriteCoord

  • private impure subroutine hdf5_obj_WriteCoord(this, groupname, name, Coord)

    Write coordinates to HDF5 file. Only the root MPI rank does the writing.

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: name

    Variable name

    class(*), intent(in) :: Coord(:)

    1-D Coordinates

procedure, private, nopass :: FixGroupName => hdf5_obj_FixGroupName

  • private pure function hdf5_obj_FixGroupName(groupname) result(val)

    Function that will append and prepend '/' if missing

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: groupname

    Return Value character(len=:), allocatable

procedure, private :: GetGroupIndex => hdf5_obj_GetGroupIndex

  • private pure function hdf5_obj_GetGroupIndex(this, name) result(val)

    Returns the index of a group

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: name

    Name of region

    Return Value integer

procedure, private :: GetGroupObject => hdf5_obj_GetGroupObject

  • private impure function hdf5_obj_GetGroupObject(this, name) result(val)

    Returns the HDF5 object id of the group

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: name

    Name of region

    Return Value integer(kind=HID_T)

procedure, private :: hdf5_obj_Read1D

  • private impure subroutine hdf5_obj_Read1D(this, basegroup, name, array)

    Read a 1D dataset located under basegroup and given by name

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: basegroup

    Parent group containing the dataset

    character(len=*), intent(in) :: name

    Dataset name

    class(*), intent(out) :: array(:,:,:)

    Data array

procedure, private :: hdf5_obj_Read3D

  • private impure subroutine hdf5_obj_Read3D(this, basegroup, name, array, lo, hi)

    Read a 3D dataset located under basegroup and given by name

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: basegroup

    Parent group containing the dataset

    character(len=*), intent(in) :: name

    Dataset name

    class(*), intent(out) :: array(:,:,:)

    Data array

    integer, intent(in) :: lo(3)

    Low bounds

    integer, intent(in) :: hi(3)

    High bounds

procedure, private :: hdf5_obj_ReadAttributes0D

  • private impure subroutine hdf5_obj_ReadAttributes0D(this, groupname, label, val)

    Read a scalar attribute under a given group

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: label

    Attribute label

    class(*), intent(out) :: val

    Attribute value

procedure, private :: hdf5_obj_ReadAttributes1D

  • private impure subroutine hdf5_obj_ReadAttributes1D(this, groupname, label, val)

    Read a 1-D array of attributes under a given group

    Arguments

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

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: label

    Attribute label

    class(*), intent(out) :: val(:)

    Attribute values

procedure, private :: hdf5_obj_Write1D

  • private impure subroutine hdf5_obj_Write1D(this, groupname, name, array)

    Write an array/1D data to a HDF5 file.

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: name

    Variable name

    class(*), intent(in) :: array(:)

    1-D data array

procedure, private :: hdf5_obj_Write3D

  • private impure subroutine hdf5_obj_Write3D(this, groupname, name, array, lo, hi)

    Write Eulerian/3D data to a HDF5 file

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: name

    Variable name

    class(*), intent(in) :: array(:,:,:)

    3-D data array

    integer, intent(in) :: lo(3)

    Low bounds

    integer, intent(in) :: hi(3)

    High bounds

procedure, private :: hdf5_obj_WriteAttributes0D

  • private impure subroutine hdf5_obj_WriteAttributes0D(this, groupname, label, val)

    Write a scalar attribute

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: label

    attribute label

    class(*), intent(in) :: val

procedure, private :: hdf5_obj_WriteAttributes1D

  • private impure subroutine hdf5_obj_WriteAttributes1D(this, groupname, label, val)

    Write an array of attributes

    Arguments

    Type IntentOptional Attributes Name
    class(hdf5_obj), intent(inout) :: this

    A HDF5 object

    character(len=*), intent(in) :: groupname

    Groupname

    character(len=*), intent(in) :: label

    attribute label

    class(*), intent(in) :: val(:)