tbl_h5_create_dbl Subroutine

private subroutine tbl_h5_create_dbl(me, location, name, datas)

Arguments

Type IntentOptional Attributes Name
class(growing_h5_tbl_t), intent(inout) :: me
integer(kind=hid_t), intent(in) :: location
character(len=*), intent(in) :: name
real(kind=dp), intent(in) :: datas(..)

Calls

proc~~tbl_h5_create_dbl~~CallsGraph proc~tbl_h5_create_dbl tbl_h5_create_dbl h5dcreate_f h5dcreate_f proc~tbl_h5_create_dbl->h5dcreate_f h5dwrite_f h5dwrite_f proc~tbl_h5_create_dbl->h5dwrite_f h5pclose_f h5pclose_f proc~tbl_h5_create_dbl->h5pclose_f h5pcreate_f h5pcreate_f proc~tbl_h5_create_dbl->h5pcreate_f h5pset_chunk_f h5pset_chunk_f proc~tbl_h5_create_dbl->h5pset_chunk_f h5sclose_f h5sclose_f proc~tbl_h5_create_dbl->h5sclose_f h5screate_simple_f h5screate_simple_f proc~tbl_h5_create_dbl->h5screate_simple_f

Called by

proc~~tbl_h5_create_dbl~~CalledByGraph proc~tbl_h5_create_dbl tbl_h5_create_dbl proc~hdf5_data_create hdf5_data_create proc~hdf5_data_create->proc~tbl_h5_create_dbl proc~hdf5_init hdf5_t%hdf5_init proc~hdf5_init->proc~tbl_h5_create_dbl proc~hdf5_init->proc~hdf5_data_create

Source Code

subroutine tbl_h5_create_dbl(me,location,name,datas)
    class(growing_h5_tbl_t), intent(inout) :: me
    integer(hid_t),     intent(in) :: location
    character(*),       intent(in) :: name
    real(dp),           intent(in) :: datas(..)

    integer :: err
    integer(hid_t)   :: prop, dspc
    integer(hsize_t) :: max_dims(8), chunk_dims(8)

    me%rank = rank(datas) + 1
    me%dims(1)         = 1
    me%dims(2:me%rank) = shape(datas)
    max_dims           = me%dims
    chunk_dims         = me%dims
    max_dims(1)        = H5S_UNLIMITED_F
    chunk_dims(1)      = 1 ! was 128, setting to 1 to avoid calls to fseek()

    call h5screate_simple_f(me%rank, me%dims, dspc, err, max_dims) 
    call h5pcreate_f(H5P_DATASET_CREATE_F, prop, err)
    call h5pset_chunk_f(prop, me%rank, chunk_dims, err)
    call h5dcreate_f(location, name, H5T_NATIVE_DOUBLE, dspc, me%dset, err, prop)
    call h5pclose_f(prop, err)
    call h5sclose_f(dspc, err)
    select rank(datas)
        rank(0)
            call h5dwrite_f(me%dset, H5T_NATIVE_DOUBLE, datas, me%dims, err)
        rank(1)
            call h5dwrite_f(me%dset, H5T_NATIVE_DOUBLE, datas, me%dims, err)
        rank(2)
            call h5dwrite_f(me%dset, H5T_NATIVE_DOUBLE, datas, me%dims, err)
        rank default
            error stop "growing array can be only rank from 0 to 2"
    end select
end subroutine tbl_h5_create_dbl