CreateGroup_HDF5 Subroutine

public subroutine CreateGroup_HDF5(fileId, groupName)

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(in) :: fileId
character, intent(in) :: groupName

Contents

Source Code


Source Code

  subroutine CreateGroup_HDF5(fileId,groupName)
#undef __FUNC__
#define __FUNC__ "CreateGroup_HDF5"
    implicit none
    integer(HID_T),intent(in) :: fileId
    character(*),intent(in) :: groupName
    ! Local
    integer(HID_T) :: groupId
    logical :: groupExists
    integer :: error

    call h5lexists_f(fileId,trim(groupName),groupExists,error)
    if(error /= 0) then
      print*,__FILE__," : Link check failure for "//trim(groupName)
    else

      if(.not. groupExists) then
        ! Create groups
        call h5gcreate_f(fileId,trim(groupName),groupId,error)

        if(error /= 0) then
          print*,__FILE__," :Failed to create group "//trim(groupName)
        endif

        call h5gclose_f(groupId,error)

        if(error /= 0) then
          print*,__FILE__," :Failed to close group "//trim(groupName)
        endif

      endif

    endif

  endsubroutine CreateGroup_HDF5