f_esmf_stategetitemnames Subroutine

subroutine f_esmf_stategetitemnames(state, numItems, itemNameList, itemTypeList, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_State), intent(in) :: state
integer, intent(in) :: numItems
character(len=*), intent(inout) :: itemNameList(numItems)
type(ESMF_StateItem_Flag), intent(inout) :: itemTypeList(numItems)
integer, intent(out) :: rc

Source Code

   subroutine f_esmf_stategetitemnames(state, numItems, itemNameList, &
                                       itemTypeList, rc)
#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_statgetitemnames"

       use ESMF_UtilTypesMod
       use ESMF_LogErrMod
       use ESMF_StateTypesMod
       use ESMF_BaseMod    ! ESMF base class
       use ESMF_StateMod
       use ESMF_ArrayCreateMod
       implicit none

       type(ESMF_State), intent(in)              :: state                  !in
       integer, intent(in)                       :: numItems               !in
       character(len=*), intent(inout)           :: itemNameList(numItems) !out
       type(ESMF_StateItem_Flag), intent(inout)  :: itemTypeList(numItems) !out
       integer, intent(out)                      :: rc                     !out

       ! local variable
       integer                    :: itemCount
       character(len (itemNameList)) :: localNameList(numItems)
       type(ESMF_StateItem_Flag)  :: localTypeList(numItems)

       integer                    :: i
       integer                    :: localrc

       ! Initialize return code; assume routine not implemented
       rc = ESMF_RC_NOT_IMPL

!       call ESMF_StateGetInfo(state=state, itemCount=itemCount, &
!                              itemNameList=localNameList, &
!                              stateitemtypeList=localTypeList, rc=rc)
       call ESMF_StateGet(state=state, itemCount=itemCount, &
                          itemNameList=localNameList, &
                          itemtypeList=localTypeList, rc=localrc)
       if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU,  &
           ESMF_CONTEXT, rcToReturn=rc)) return

       do i = 1, itemCount
          itemTypeList(i) = localTypeList(i)
          itemNameList(i) = localNameList(i)
       enddo

       rc = localrc

   end subroutine f_esmf_stategetitemnames