Reads Eulerian data with LEAP's HDF5.
| Type | Intent | Optional | 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 |
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