ESMF_ConfigGetIntsI4 Subroutine

private subroutine ESMF_ConfigGetIntsI4(config, valueList, keywordEnforcer, count, label, default, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Config), intent(inout) :: config
integer(kind=ESMF_KIND_I4), intent(inout) :: valueList(:)
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(in), optional :: count
character(len=*), intent(in), optional :: label
integer(kind=ESMF_KIND_I4), intent(in), optional :: default
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_ConfigGetIntsI4(config, valueList, &
        keywordEnforcer, count, label, default, rc)

! !ARGUMENTS:
      type(ESMF_Config),     intent(inout)         :: config
      integer(ESMF_KIND_I4), intent(inout)         :: valueList(:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      integer,               intent(in),  optional :: count
      character(len=*),      intent(in),  optional :: label
      integer(ESMF_KIND_I4), intent(in),  optional :: default
      integer,               intent(out), optional :: rc
!
! !DESCRIPTION: 
!  Gets a 4-byte integer {\tt valueList} of given {\tt count} from the 
!  {\tt config} object.
!
!   The arguments are:
!   \begin{description}
!   \item [config]
!     Already created {\tt ESMF\_Config} object.
!   \item [valueList]
!     Returned values. 
!   \item [count]
!     Number of returned values expected. 
!   \item [{[label]}]
!     Identifying label. 
!   \item [{[default]}]
!     Default value if label is not found in configuration object. 
!   \item [{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOPI -------------------------------------------------------------------
!
      integer :: localrc
      integer :: localcount
      integer :: i 
      logical :: found
      
      ! Initialize return code; assume routine not implemented
      if (present(rc)) rc = ESMF_RC_NOT_IMPL

      localrc = ESMF_SUCCESS
      !check variables
      ESMF_INIT_CHECK_DEEP(ESMF_ConfigGetInit,config,rc)

      localcount = size (valueList)
      if (present (count)) then
        if (count <= 0) then
           if (ESMF_LogFoundError(ESMF_RC_OBJ_BAD, &
                                  msg="invalid SIZE", &
                                   ESMF_CONTEXT, rcToReturn=rc)) return
        else if (count > size (valueList)) then
           if (ESMF_LogFoundError(ESMF_RC_OBJ_BAD, &
                                  msg="invalid SIZE", &
                                   ESMF_CONTEXT, rcToReturn=rc)) return
        else
           localcount = count
        end if
      endif
       
 ! Default setting
      if( present( default ) ) then 
         valueList(1:localcount) = default
      else
         valueList(1:localcount) = 0
      endif

! Processing 
      if (present( label )) then
         call ESMF_ConfigFindLabel( config, label=label,  &
             isPresent=found, rc=localrc)
         if (ESMF_LogFoundError (localrc, ESMF_ERR_PASSTHRU,  &
             ESMF_CONTEXT, rcToReturn=rc)) return
         if (.not. found)  &
             localrc = ESMF_RC_NOT_FOUND
      end if

      do i = 1, localcount
         
         if(present( default )) then
            call ESMF_ConfigGetIntI4( config, valueList(i), default = default, rc = localrc)
         else
            call ESMF_ConfigGetIntI4( config, valueList(i), rc = localrc)
         endif
      enddo

      if(present( rc )) then
        rc = localrc
      endif

    end subroutine ESMF_ConfigGetIntsI4