hdf5_write Subroutine

private subroutine hdf5_write(me, t, dt, t_final)

Type Bound

hdf5_t

Arguments

Type IntentOptional Attributes Name
class(hdf5_t), intent(inout) :: me
real(kind=dp), intent(in) :: t
real(kind=dp), intent(in) :: dt
real(kind=dp), intent(in) :: t_final

Calls

proc~~hdf5_write~~CallsGraph proc~hdf5_write hdf5_t%hdf5_write proc~tbl_h5_append_dbl tbl_h5_append_dbl proc~hdf5_write->proc~tbl_h5_append_dbl proc~tbl_h5_revert_dbl tbl_h5_revert_dbl proc~hdf5_write->proc~tbl_h5_revert_dbl h5dget_space_f h5dget_space_f proc~tbl_h5_append_dbl->h5dget_space_f h5dset_extent_f h5dset_extent_f proc~tbl_h5_append_dbl->h5dset_extent_f h5dwrite_f h5dwrite_f proc~tbl_h5_append_dbl->h5dwrite_f h5sclose_f h5sclose_f proc~tbl_h5_append_dbl->h5sclose_f h5screate_simple_f h5screate_simple_f proc~tbl_h5_append_dbl->h5screate_simple_f h5sselect_hyperslab_f h5sselect_hyperslab_f proc~tbl_h5_append_dbl->h5sselect_hyperslab_f interface~h5dflush H5Dflush proc~tbl_h5_append_dbl->interface~h5dflush proc~tbl_h5_revert_dbl->h5dset_extent_f proc~tbl_h5_revert_dbl->interface~h5dflush

Source Code

subroutine hdf5_write(me,t,dt,t_final)
    class(hdf5_t), intent(inout) :: me
    real(dp), intent(in) :: t,dt,t_final

    real(dp) :: data_global(2,1), NextWriteTime
    integer :: i
    logical :: LastTimeStep

    if(.not.me%write_results) return
    NextWriteTime = me%last_saved_time + me%min_save_time 
    LastTimeStep = t + sim_delta >= t_final
    if(t < NextWriteTime .and. .not. LastTimeStep) then
        if(me%steps_to_revert > 0) then
            call tbl_h5_revert_dbl(me%time,   me%steps_to_revert)
            call tbl_h5_revert_dbl(me%global, me%steps_to_revert)
            do i = 1, size(me%tables)
                if(me%tables(i)%dims(2) /= 0) &
                    call tbl_h5_revert_dbl(me%tables(i), me%steps_to_revert)
            enddo
            me%steps_to_revert = 0
            me%last_saved_time = t
        endif
        return
    endif
    me%last_saved_time = t
    
    do i = 1, size(me%tables)
        if (me%tables(i)%dims(2) /= 0) &
            call tbl_h5_append_dbl(me%tables(i), me%tables(i)%data)
    enddo

    data_global(:,1) = [dt,dt]
    call tbl_h5_append_dbl(me%global, data_global)

    call tbl_h5_append_dbl(me%time,t)
end subroutine hdf5_write