write_atribute_int Subroutine

private subroutine write_atribute_int(location, attribute_name, attribute_value)

Arguments

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

hdf5 file or group id

character(len=*), intent(in) :: attribute_name
integer, intent(in) :: attribute_value(..)

from scalar up to rank 3


Calls

proc~~write_atribute_int~~CallsGraph proc~write_atribute_int write_atribute_int h5aclose_f h5aclose_f proc~write_atribute_int->h5aclose_f h5acreate_f h5acreate_f proc~write_atribute_int->h5acreate_f h5awrite_f h5awrite_f proc~write_atribute_int->h5awrite_f h5sclose_f h5sclose_f proc~write_atribute_int->h5sclose_f h5screate_simple_f h5screate_simple_f proc~write_atribute_int->h5screate_simple_f

Called by

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

Source Code

subroutine write_atribute_int(location,attribute_name,attribute_value)
    integer(hid_t), intent(in) :: location            !! hdf5 file or group id
    character(*),   intent(in) :: attribute_name
    integer,        intent(in) :: attribute_value(..) !! from scalar up to rank 3

    integer :: error, rank_in
    integer(hid_t)   :: dspc_id, attr_id
    integer(hsize_t), allocatable :: dims(:)

    rank_in = rank(attribute_value)
    dims = shape(attribute_value)
    call h5screate_simple_f(rank_in, dims, dspc_id, error, dims)
    call h5acreate_f(location, attribute_name, H5T_NATIVE_INTEGER, dspc_id, attr_id, error)
    select rank(attribute_value)
        rank(0)
            call h5awrite_f(attr_id, H5T_NATIVE_INTEGER, attribute_value, dims, error)
        rank(1)
            call h5awrite_f(attr_id, H5T_NATIVE_INTEGER, attribute_value, dims, error)
        rank(2)
            call h5awrite_f(attr_id, H5T_NATIVE_INTEGER, attribute_value, dims, error)
        rank(3)
            call h5awrite_f(attr_id, H5T_NATIVE_INTEGER, attribute_value, dims, error)
        rank default
            error stop 'Integer attribute rank can be from 0 to 3'
    end select
    call h5aclose_f(attr_id, error)
    call h5sclose_f(dspc_id, error)
    deallocate(dims)
end subroutine write_atribute_int