write_attribute_vstr1d Subroutine

private subroutine write_attribute_vstr1d(location, attribute_name, value_in, length)

BROKEN: (not variable) Write 1d atribute variable string array to hdf5 file

Arguments

Type IntentOptional Attributes Name
integer(kind=hid_t), intent(in) :: location

hdf5 file or group id

character(len=*), intent(in) :: attribute_name
character(len=*), intent(in) :: value_in(:)

from scalar up to rank 3

integer(kind=size_t), intent(in) :: length(:)

Calls

proc~~write_attribute_vstr1d~~CallsGraph proc~write_attribute_vstr1d write_attribute_vstr1d h5aclose_f h5aclose_f proc~write_attribute_vstr1d->h5aclose_f h5acreate_f h5acreate_f proc~write_attribute_vstr1d->h5acreate_f h5awrite_f h5awrite_f proc~write_attribute_vstr1d->h5awrite_f h5sclose_f h5sclose_f proc~write_attribute_vstr1d->h5sclose_f h5screate_simple_f h5screate_simple_f proc~write_attribute_vstr1d->h5screate_simple_f h5tclose_f h5tclose_f proc~write_attribute_vstr1d->h5tclose_f h5tcopy_f h5tcopy_f proc~write_attribute_vstr1d->h5tcopy_f h5tset_size_f h5tset_size_f proc~write_attribute_vstr1d->h5tset_size_f

Called by

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

Source Code

subroutine write_attribute_vstr1d(location,attribute_name,value_in,length)
    !! BROKEN: (not variable) Write 1d atribute variable string array to hdf5 file
    integer(hid_t),  intent(in) :: location  !! hdf5 file or group id
    character(*),    intent(in) :: attribute_name
    character(*),    intent(in) :: value_in(:)  !! from scalar up to rank 3
    integer(size_t), intent(in) :: length(:) !! BROKEN: unused right now

    integer(hid_t)   :: dspc_id, dset_id, tstr_id
    integer(hsize_t) :: dims2(2),dims1(1)
    integer          :: i,err
    character(:),allocatable :: val(:)


    dims2(1) = len(value_in) + 1
    dims2(2) = size(value_in)
    dims1(1) = dims2(2)
    allocate(character(dims2(1)) :: val(dims2(2)))
    do i = 1, size(val)
        val(i) = trim(value_in(i))//char(0)
    enddo
    call h5tcopy_f(H5T_C_S1, tstr_id, err)
    call h5tset_size_f(tstr_id, dims2(1), err)
    call h5screate_simple_f(1, dims1, dspc_id, err)
    call h5acreate_f(location, attribute_name, tstr_id, dspc_id, dset_id, err)
    call h5awrite_f(dset_id, tstr_id, val, dims2, err)
    call h5tclose_f(tstr_id,err)
    call h5sclose_f(dspc_id,err)
    call h5aclose_f(dset_id,err)
end subroutine write_attribute_vstr1d