hdf5_obj_ReadDatasetNames Subroutine

private impure subroutine hdf5_obj_ReadDatasetNames(this, basegroup, names)

Uses

  • proc~~hdf5_obj_readdatasetnames~~UsesGraph proc~hdf5_obj_readdatasetnames hdf5_obj%hdf5_obj_ReadDatasetNames iso_c_binding iso_c_binding proc~hdf5_obj_readdatasetnames->iso_c_binding

Reads the dataset names under a given base group in an HDF5 file.

Type Bound

hdf5_obj

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(:)

Dataset names under the base group


Calls

proc~~hdf5_obj_readdatasetnames~~CallsGraph proc~hdf5_obj_readdatasetnames hdf5_obj%hdf5_obj_ReadDatasetNames h5gn_members_f h5gn_members_f proc~hdf5_obj_readdatasetnames->h5gn_members_f h5iget_name_f h5iget_name_f proc~hdf5_obj_readdatasetnames->h5iget_name_f h5oclose_f h5oclose_f proc~hdf5_obj_readdatasetnames->h5oclose_f h5oget_info_f h5oget_info_f proc~hdf5_obj_readdatasetnames->h5oget_info_f h5oopen_by_idx_f h5oopen_by_idx_f proc~hdf5_obj_readdatasetnames->h5oopen_by_idx_f proc~hdf5_obj_fixgroupname hdf5_obj%hdf5_obj_FixGroupName proc~hdf5_obj_readdatasetnames->proc~hdf5_obj_fixgroupname

Called by

proc~~hdf5_obj_readdatasetnames~~CalledByGraph proc~hdf5_obj_readdatasetnames hdf5_obj%hdf5_obj_ReadDatasetNames proc~h5hut_obj_getnpoints h5hut_obj%h5hut_obj_GetNPoints proc~h5hut_obj_getnpoints->proc~hdf5_obj_readdatasetnames proc~marker_set_readh5hut marker_set%marker_set_ReadH5HUT proc~marker_set_readh5hut->proc~h5hut_obj_getnpoints proc~particle_set_readh5hut particle_set%particle_set_ReadH5HUT proc~particle_set_readh5hut->proc~h5hut_obj_getnpoints proc~respart_set_readh5hut ResPart_set%ResPart_set_ReadH5HUT proc~respart_set_readh5hut->proc~h5hut_obj_getnpoints

Source Code

    impure subroutine hdf5_obj_ReadDatasetNames(this,basegroup,names)
      !> Reads the dataset names under a given base group in an HDF5 file.
      use iso_c_binding
      implicit none
      class(hdf5_obj),  intent(inout) :: this                                  !! A HDF5 object
      character(len=*), intent(in)    :: basegroup                             !! Base group to explore
      character(len=str64), &
           allocatable, intent(out)   :: names(:)                              !! Dataset names under the base group
      ! Work variables
      integer(HID_T)      :: obj
      type(H5O_info_t)    :: info
      character(len=str64):: obj_name
      integer(SIZE_T)     :: name_size
      integer             :: idx
      integer             :: ierr
      integer             :: nobj
      character(len=:), &
              allocatable :: groupname
      character(len=:), &
              allocatable :: name_

      ! Initilize the array of names as an empty array
      names = [character(len=str64)::]

      ! Make sure basegroup is properly formatted,
      ! with '/' at the begining and end
      groupname=this%FixGroupName(basegroup)

      ! Get total number of objects under this group
      call H5Gn_members_f(this%fid,groupname,nobj,ierr)

      ! Iterate over objects under the basegroup
      do idx = 0, nobj - 1
        ! Open object
        call H5Oopen_by_idx_f(this%fid,groupname,H5_INDEX_NAME_F,H5_ITER_NATIVE_F, int(idx,HSIZE_T),obj,ierr)
        if (ierr.eq.0) then
          ! Get name and info of the object
          call H5Iget_name_f(obj,obj_name,int(str64,SIZE_T),name_size,ierr)
          call H5Oget_info_f(obj,info,ierr)

          ! Consider only objects that are datasets
          if ( info%type .eq. H5O_TYPE_DATASET_F) then
            ! Add object name to list
            name_ = obj_name(len(groupname)+1:name_size)
            names = [character(len=str64):: names(:), name_]

          end if

          ! Close object
          call H5Oclose_f(obj,ierr)
        end if
      end do

      return
    end subroutine hdf5_obj_ReadDatasetNames