| Type | Intent | Optional | 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 |
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