Finds the index of the first variable with name vname
.
This routine is case insensitive.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(MAPL_SimpleBundle) | :: | self | ||||
character(len=*), | intent(in) | :: | name |
variable name |
||
integer, | intent(in) | :: | rank | |||
integer, | intent(out), | optional | :: | rc | ||
logical, | intent(in), | optional | :: | quiet |
index of variable
function MAPL_SimpleBundleGetIndex ( self, name, rank, rc, quiet ) result(iq) integer :: iq !! index of variable type(MAPL_SimpleBundle) :: self character(len=*), intent(in) :: name !! variable name integer, intent(in) :: rank integer, OPTIONAL, intent(out) :: rc logical, OPTIONAL, intent(in) :: quiet ! !----------------------------------------------------------------------------- character(len=ESMF_MAXSTR) :: message logical :: quiet_ integer :: i if ( present(quiet) ) then quiet_ = quiet else quiet_ = .FALSE. end if iq = -1 if ( rank == 1 ) then do i = 1, self%n1d if (trim(self%r1(i)%name) == trim(name) ) then iq = i exit endif end do else if ( rank == 2 ) then do i = 1, self%n2d if (trim(self%r2(i)%name) == trim(name) ) then iq = i exit endif end do else if ( rank == 3 ) then do i = 1, self%n3d if (trim(self%r3(i)%name) == trim(name) ) then iq = i exit endif end do else if ( present(rc) ) then __raise__(MAPL_RC_ERROR,"invalid rank") end if end if if ( present(rc) ) then if ( iq <= 0 ) then if ( quiet_ ) then rc = MAPL_RC_ERROR return else message = "could not find index for "//trim(name)// & ' in Simple Bundle <'//trim(self%name)//'>' __raise__(MAPL_RC_ERROR,message) end if else _RETURN(ESMF_SUCCESS) end if end if _RETURN(_SUCCESS) end function MAPL_SimpleBundleGetIndex