Write Eulerian data using LEAP's HDF5.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(eulerian_set), | intent(inout) | :: | this |
An Eulerian Set |
||
| integer, | intent(in) | :: | iter |
Iteration at write |
||
| real(kind=wp), | intent(in) | :: | time |
Time at write |
||
| character(len=str8), | intent(in), | optional | :: | list(:) |
Names of fields to write |
impure subroutine eulerian_set_WriteHDF5(this,iter,time,list) !> Write Eulerian data using LEAP's HDF5. use leapUtils, only: stringtool_obj implicit none class(eulerian_set), intent(inout):: this !! An Eulerian Set integer, intent(in) :: iter !! Iteration at write real(wp), intent(in) :: time !! Time at write character(str8), intent(in), & optional :: list(:) !! Names of fields to write ! Work variables type(sysutils_obj) :: sysutils type(stringtool_obj):: stringtool character(len=:), & allocatable :: filename character(len=str64):: tmpC type(hdf5_obj) :: hdf5 integer :: n,ind ! Nothing to write, if empty if (.not.allocated(this%field)) return if (this%parallel%RankIsRoot()) & call sysutils%CreateDirectory('Hdf5') filename = 'Hdf5/'//stringtool%RemoveExtension(this%write_file) ! Initialize HDF5 call hdf5%Initialize(this%parallel) ! Open the file if (this%overwrite) then write(tmpC,'(ES12.4)') time filename = filename//"_"//trim(adjustl(tmpC)) call hdf5%Open(filename,"W") else call hdf5%Open(filename,"RW") end if ! Write time call hdf5%WriteAttributes("/","time",time) call hdf5%WriteAttributes("/","iter",iter) if (.not.present(list)) then ! Write all fields do n=1,size(this%field) call this%WriteSingle(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%WriteSingle(hdf5,ind) end do end if ! Close file call hdf5%Close() ! Finalize HDF5 call hdf5%Finalize() return end subroutine eulerian_set_WriteHDF5