eulerian_set_ReadHDF5 Subroutine

private impure subroutine eulerian_set_ReadHDF5(this, iter, time, list)

Uses

  • proc~~eulerian_set_readhdf5~~UsesGraph proc~eulerian_set_readhdf5 eulerian_set%eulerian_set_ReadHDF5 module~leaputils leapUtils proc~eulerian_set_readhdf5->module~leaputils module~leapkinds leapKinds module~leaputils->module~leapkinds iso_fortran_env iso_fortran_env module~leapkinds->iso_fortran_env

Reads Eulerian data with LEAP's HDF5.

Type Bound

eulerian_set

Arguments

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

an eulerian set

integer, intent(out) :: iter

iteration in file

real(kind=wp), intent(out) :: time

time in file

character(len=str8), intent(in), optional :: list(:)

names of fields to read


Calls

proc~~eulerian_set_readhdf5~~CallsGraph proc~eulerian_set_readhdf5 eulerian_set%eulerian_set_ReadHDF5 none~readattributes hdf5_obj%ReadAttributes proc~eulerian_set_readhdf5->none~readattributes none~readsingle eulerian_set%ReadSingle proc~eulerian_set_readhdf5->none~readsingle proc~eulerian_set_getindex eulerian_set%eulerian_set_GetIndex proc~eulerian_set_readhdf5->proc~eulerian_set_getindex proc~hdf5_obj_final hdf5_obj%hdf5_obj_Final proc~eulerian_set_readhdf5->proc~hdf5_obj_final proc~hdf5_obj_init hdf5_obj%hdf5_obj_Init proc~eulerian_set_readhdf5->proc~hdf5_obj_init proc~parallel_obj_rankisroot parallel_obj%parallel_obj_RankIsRoot proc~eulerian_set_readhdf5->proc~parallel_obj_rankisroot proc~stringtool_obj_removeextension stringtool_obj%stringtool_obj_RemoveExtension proc~eulerian_set_readhdf5->proc~stringtool_obj_removeextension proc~stringtool_obj_removepath stringtool_obj%stringtool_obj_RemovePath proc~eulerian_set_readhdf5->proc~stringtool_obj_removepath proc~xdmf_obj_addfield xdmf_obj%xdmf_obj_AddField proc~eulerian_set_readhdf5->proc~xdmf_obj_addfield proc~xdmf_obj_addgrid xdmf_obj%xdmf_obj_AddGrid proc~eulerian_set_readhdf5->proc~xdmf_obj_addgrid proc~hdf5_obj_readattributes0d hdf5_obj%hdf5_obj_ReadAttributes0D none~readattributes->proc~hdf5_obj_readattributes0d proc~hdf5_obj_readattributes1d hdf5_obj%hdf5_obj_ReadAttributes1D none~readattributes->proc~hdf5_obj_readattributes1d proc~eulerian_set_readsingleh5hut eulerian_set%eulerian_set_ReadSingleH5HUT none~readsingle->proc~eulerian_set_readsingleh5hut proc~eulerian_set_readsinglehdf5 eulerian_set%eulerian_set_ReadSingleHDF5 none~readsingle->proc~eulerian_set_readsinglehdf5 none~get~3 hashtbl_obj%Get proc~eulerian_set_getindex->none~get~3 proc~hashtbl_obj_hashstring hashtbl_obj%hashtbl_obj_HashString proc~eulerian_set_getindex->proc~hashtbl_obj_hashstring h5garbage_collect_f h5garbage_collect_f proc~hdf5_obj_final->h5garbage_collect_f proc~hashtbl_obj_final hashtbl_obj%hashtbl_obj_Final proc~hdf5_obj_final->proc~hashtbl_obj_final h5open_f h5open_f proc~hdf5_obj_init->h5open_f proc~hashtbl_obj_init hashtbl_obj%hashtbl_obj_Init proc~hdf5_obj_init->proc~hashtbl_obj_init proc~xdmf_obj_resize xdmf_obj%xdmf_obj_Resize proc~xdmf_obj_addfield->proc~xdmf_obj_resize proc~hashtbl_obj_get_int4 hashtbl_obj%hashtbl_obj_Get_int4 none~get~3->proc~hashtbl_obj_get_int4 proc~hashtbl_obj_get_int8 hashtbl_obj%hashtbl_obj_Get_int8 none~get~3->proc~hashtbl_obj_get_int8 proc~hashtbl_obj_get_real_dp hashtbl_obj%hashtbl_obj_Get_real_dp none~get~3->proc~hashtbl_obj_get_real_dp proc~hashtbl_obj_get_real_sp hashtbl_obj%hashtbl_obj_Get_real_sp none~get~3->proc~hashtbl_obj_get_real_sp cell cell proc~eulerian_set_readsingleh5hut->cell proc~eulerian_obj_updateghostcells eulerian_obj_base%eulerian_obj_UpdateGhostCells proc~eulerian_set_readsingleh5hut->proc~eulerian_obj_updateghostcells proc~eulerian_set_readsinglehdf5->cell proc~eulerian_set_readsinglehdf5->proc~eulerian_obj_updateghostcells h5aclose_f h5aclose_f proc~hdf5_obj_readattributes0d->h5aclose_f h5aget_space_f h5aget_space_f proc~hdf5_obj_readattributes0d->h5aget_space_f h5aget_type_f h5aget_type_f proc~hdf5_obj_readattributes0d->h5aget_type_f h5aopen_f h5aopen_f proc~hdf5_obj_readattributes0d->h5aopen_f h5aread_f h5aread_f proc~hdf5_obj_readattributes0d->h5aread_f h5sclose_f h5sclose_f proc~hdf5_obj_readattributes0d->h5sclose_f h5sget_simple_extent_dims_f h5sget_simple_extent_dims_f proc~hdf5_obj_readattributes0d->h5sget_simple_extent_dims_f proc~hdf5_obj_closegroup hdf5_obj%hdf5_obj_CloseGroup proc~hdf5_obj_readattributes0d->proc~hdf5_obj_closegroup proc~hdf5_obj_getgroupobject hdf5_obj%hdf5_obj_GetGroupObject proc~hdf5_obj_readattributes0d->proc~hdf5_obj_getgroupobject proc~hdf5_obj_opengroup hdf5_obj%hdf5_obj_OpenGroup proc~hdf5_obj_readattributes0d->proc~hdf5_obj_opengroup proc~hdf5_obj_readattributes1d->h5aclose_f proc~hdf5_obj_readattributes1d->h5aget_space_f proc~hdf5_obj_readattributes1d->h5aget_type_f proc~hdf5_obj_readattributes1d->h5aopen_f proc~hdf5_obj_readattributes1d->h5aread_f proc~hdf5_obj_readattributes1d->h5sclose_f proc~hdf5_obj_readattributes1d->h5sget_simple_extent_dims_f proc~hdf5_obj_readattributes1d->proc~hdf5_obj_closegroup proc~hdf5_obj_readattributes1d->proc~hdf5_obj_getgroupobject proc~hdf5_obj_readattributes1d->proc~hdf5_obj_opengroup proc~eulerian_obj_updateghostcells_x eulerian_obj_base%eulerian_obj_UpdateGhostCells_x proc~eulerian_obj_updateghostcells->proc~eulerian_obj_updateghostcells_x proc~eulerian_obj_updateghostcells_y eulerian_obj_base%eulerian_obj_UpdateGhostCells_y proc~eulerian_obj_updateghostcells->proc~eulerian_obj_updateghostcells_y proc~eulerian_obj_updateghostcells_z eulerian_obj_base%eulerian_obj_UpdateGhostCells_z proc~eulerian_obj_updateghostcells->proc~eulerian_obj_updateghostcells_z none~get~2 sllist_obj%Get proc~hashtbl_obj_get_int4->none~get~2 proc~hashtbl_obj_get_int8->none~get~2 proc~hashtbl_obj_get_real_dp->none~get~2 proc~hashtbl_obj_get_real_sp->none~get~2 proc~hdf5_obj_closegroup->proc~hashtbl_obj_hashstring proc~hdf5_obj_closegroup->proc~hdf5_obj_getgroupobject h5gclose_f h5gclose_f proc~hdf5_obj_closegroup->h5gclose_f proc~hashtbl_obj_remove hashtbl_obj%hashtbl_obj_Remove proc~hdf5_obj_closegroup->proc~hashtbl_obj_remove proc~hdf5_obj_fixgroupname hdf5_obj%hdf5_obj_FixGroupName proc~hdf5_obj_closegroup->proc~hdf5_obj_fixgroupname proc~hdf5_obj_getgroupobject->none~get~3 proc~hdf5_obj_getgroupobject->proc~hashtbl_obj_hashstring proc~hdf5_obj_getgroupobject->proc~hdf5_obj_fixgroupname proc~hdf5_obj_opengroup->proc~hashtbl_obj_hashstring proc~hdf5_obj_opengroup->proc~hdf5_obj_getgroupobject h5oopen_f h5oopen_f proc~hdf5_obj_opengroup->h5oopen_f proc~hashtbl_obj_put hashtbl_obj%hashtbl_obj_Put proc~hdf5_obj_opengroup->proc~hashtbl_obj_put proc~hdf5_obj_opengroup->proc~hdf5_obj_fixgroupname proc~sllist_obj_get_int4 sllist_obj%sllist_obj_Get_int4 none~get~2->proc~sllist_obj_get_int4 proc~sllist_obj_get_int8 sllist_obj%sllist_obj_Get_int8 none~get~2->proc~sllist_obj_get_int8 proc~sllist_obj_get_real_dp sllist_obj%sllist_obj_Get_real_dp none~get~2->proc~sllist_obj_get_real_dp proc~sllist_obj_get_real_sp sllist_obj%sllist_obj_Get_real_sp none~get~2->proc~sllist_obj_get_real_sp proc~eulerian_obj_updateghostcells_x->cell mpi_irecv mpi_irecv proc~eulerian_obj_updateghostcells_x->mpi_irecv mpi_isend mpi_isend proc~eulerian_obj_updateghostcells_x->mpi_isend mpi_waitall mpi_waitall proc~eulerian_obj_updateghostcells_x->mpi_waitall proc~eulerian_obj_updateghostcells_y->cell proc~eulerian_obj_updateghostcells_y->mpi_irecv proc~eulerian_obj_updateghostcells_y->mpi_isend proc~eulerian_obj_updateghostcells_y->mpi_waitall proc~eulerian_obj_updateghostcells_z->cell proc~eulerian_obj_updateghostcells_z->mpi_irecv proc~eulerian_obj_updateghostcells_z->mpi_isend proc~eulerian_obj_updateghostcells_z->mpi_waitall proc~sllist_obj_put sllist_obj%sllist_obj_Put proc~hashtbl_obj_put->proc~sllist_obj_put proc~sllist_obj_remove sllist_obj%sllist_obj_Remove proc~hashtbl_obj_remove->proc~sllist_obj_remove proc~sllist_obj_get_int4->proc~sllist_obj_get_int4 proc~sllist_obj_get_int8->proc~sllist_obj_get_int8 proc~sllist_obj_get_real_dp->proc~sllist_obj_get_real_dp proc~sllist_obj_get_real_sp->proc~sllist_obj_get_real_sp proc~sllist_obj_put->proc~sllist_obj_put

Source Code

    impure subroutine eulerian_set_ReadHDF5(this,iter,time,list)
      !> Reads Eulerian data with LEAP's HDF5.
      use leapUtils, only: stringtool_obj
      implicit none
      class(eulerian_set), intent(inout):: this                                !! an eulerian set
      integer,             intent(out)  :: iter                                !! iteration in file
      real(wp),            intent(out)  :: time                                !! time in file
      character(str8),     intent(in),   &
                               optional :: list(:)                             !! names of fields to read
      ! Work variables
      type(stringtool_obj):: stringtool
      character(len=:),      &
            allocatable   :: filename
      type(hdf5_obj)      :: hdf5
      integer             :: n,ind
      type(xdmf_obj)      :: xdmf
      integer             :: maxhi(3)
      integer             :: minlo(3)

      ! Nothing to read, if empty
      if (.not.allocated(this%field)) return

      filename = 'Hdf5/'//stringtool%RemoveExtension(this%read_file)

      ! Initialize HDF5
      call hdf5%Initialize(this%parallel)

      ! Open file
      call hdf5%Open(trim(adjustl(filename)),'R')

      ! Read time and iter
      call hdf5%ReadAttributes("/","time",time)
      call hdf5%ReadAttributes("/","iter",iter)

      if (.not.present(list)) then
        ! Read all fields
        do n=1,size(this%field)
          call this%ReadSingle(hdf5,n)
        end do
      else
        do  n=1,size(list)
          ! Get index of this Eulerian_obj
          ind = this%GetIndex(list(n))
          if (ind.lt.1) call this%parallel%Stop('Unable to find '//list(n)//' in Eulerian_set')

          call this%ReadSingle(hdf5,ind)
        end do
      end if

      ! Close file
      call hdf5%Close()

      ! Finalize HDF5
      call hdf5%Finalize()

      ! Determine max and min grid extents
      call this%parallel%Min(this%block%lo,minlo)
      call this%parallel%Max(this%block%hi,maxhi)

      ! Write companion XDMF file
      if (this%parallel%RankIsRoot()) then
        ! Intialize XDMF object
        call xdmf%Initialize()

        ! Add grid info to XDMF object
        call xdmf%AddGrid('mesh',maxhi-minlo+1, 'block'//HDF5_EXTENSION,'x1','x2','x3')

        ! Add field info to XDMF object
        do n=1,size(this%field)
          select type (my_field => this%field(n)%p)
          type is (eulerian_obj_r)
            if (wp.eq.leapSP) &
              call xdmf%AddField(my_field%name,'Float','4',stringtool%RemovePath(filename)//HDF5_EXTENSION)
            if (wp.eq.leapDP) &
              call xdmf%AddField(my_field%name,'Float','8',stringtool%RemovePath(filename)//HDF5_EXTENSION)
          type is (eulerian_obj_i)
            call xdmf%AddField(my_field%name,'Int',  '4',stringtool%RemovePath(filename)//HDF5_EXTENSION)
          end select
        end do

        ! Write XDMF file
        call xdmf%Write(filename)

        ! Finalize XDMF object
        call xdmf%Finalize()
      end if

      return
    end subroutine eulerian_set_ReadHDF5