Returns the number of points in a dataset given by name under group given by name.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Parent group name |
||
| character(len=*), | intent(in) | :: | name |
Dataset name |
Result
impure function hdf5_obj_GetNPoints(this,groupname,name) result(val) !> Returns the number of points in a dataset given by name under group given by name. implicit none class(hdf5_obj), intent(inout) :: this !! A HDF5 object character(len=*), intent(in) :: groupname !! Parent group name character(len=*), intent(in) :: name !! Dataset name integer :: val !! Result ! Work variables integer(HID_T) :: did integer(HID_T) :: sidg integer(HSIZE_T) :: npoints integer(HID_T) :: obj integer :: ierr ! Open group, if not already open call this%OpenGroup(groupname) ! Get group object obj = this%GetGroupObject(groupname) ! Open dataset call H5Dopen_f(obj, trim(adjustl(name)), did, ierr) if (ierr.ne.0) & call this%parallel%Stop("Unable to open dataset "//trim(adjustl(name))//" under "//trim(adjustl(groupname))//" in HDF5 file "//this%filename) ! Get the global data space from file call H5Dget_space_f(did,sidg,ierr) ! Get number of points in this dataset call H5Sget_simple_extent_npoints_f(sidg,npoints,ierr) ! Close dataset call H5Dclose_f(did,ierr) ! Close data spaces call H5Sclose_f(sidg,ierr) ! Close group call this%CloseGroup(groupname) ! Return array size val = int(npoints,leapI4) return end function hdf5_obj_GetNPoints