ESMF_ConfigSetCurrentAttrUsed Subroutine

private subroutine ESMF_ConfigSetCurrentAttrUsed(config, used, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Config), intent(inout) :: config
logical, intent(in) :: used
integer, intent(out), optional :: rc

Source Code

    subroutine ESMF_ConfigSetCurrentAttrUsed( config, used, rc )


      implicit none

      type(ESMF_Config), intent(inout)         :: config ! ESMF Configuration
      logical,           intent(in)            :: used     ! used flag
      integer,           intent(out), optional :: rc       ! Error return code
!
! !DESCRIPTION: Set the given config's current attribute's used flag
!
!EOPI -------------------------------------------------------------------
      integer :: i

      ! Initialize return code; assume routine not implemented
      if ( present (rc) ) then
        rc = ESMF_RC_NOT_IMPL
      endif

      !check variables
      ESMF_INIT_CHECK_DEEP(ESMF_ConfigGetInit,config,rc)


      ! find attr label and set its used flag to given value
      !  TODO:  pre-sort and use binary search, or use hash function
      do i = 1, NATT_MAX
        if (associated (config%cptr%attr_used(i)%label)) then
          if (trim(config%cptr%current_attr) == ESMF_UtilArray2String (config%cptr%attr_used(i)%label)) then
            config%cptr%attr_used(i)%used = used
            exit
          end if
        endif
      enddo

      if (present(rc)) rc = ESMF_SUCCESS

      return

    end subroutine ESMF_ConfigSetCurrentAttrUsed