MAPL_IOCountNonDimVars Subroutine

public subroutine MAPL_IOCountNonDimVars(cf, nvars, rc)

Arguments

Type IntentOptional Attributes Name
type(FileMetadata), intent(inout) :: cf
integer, intent(out) :: nvars
integer, intent(out), optional :: rc

Calls

proc~~mapl_iocountnondimvars~~CallsGraph proc~mapl_iocountnondimvars MAPL_IOCountNonDimVars at at proc~mapl_iocountnondimvars->at none~begin~52 StringVariableMap%begin proc~mapl_iocountnondimvars->none~begin~52 none~get_dimensions~2 FileMetadata%get_dimensions proc~mapl_iocountnondimvars->none~get_dimensions~2 none~get_variables FileMetadata%get_variables proc~mapl_iocountnondimvars->none~get_variables none~key~117 StringVariableMapIterator%key proc~mapl_iocountnondimvars->none~key~117 none~next~48 StringVariableMapIterator%next proc~mapl_iocountnondimvars->none~next~48 proc~mapl_return MAPL_Return proc~mapl_iocountnondimvars->proc~mapl_return none~get_variables->proc~mapl_return proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception

Source Code

  subroutine MAPL_IOCountNonDimVars(cf,nvars,rc)
  type(FileMetadata), intent(inout) :: cf
  integer, intent(out) :: nvars
  integer, intent(out), optional :: rc

  type(StringVariableMap), pointer :: vars
  type(StringVariableMapIterator) :: iter
  type(StringIntegerMap), pointer :: dims
  integer, pointer :: dimsize => null()
  character(len=:), pointer :: name

  nvars = 0
  dims => cf%get_dimensions()
  vars => cf%get_variables()
  iter = vars%begin()
  do while(iter/=vars%end())

     name =>  iter%key()
     dimsize => dims%at(trim(name))
     if (.not.associated(dimsize)) nvars=nvars+1
     if (associated(dimsize)) nullify(dimsize)

     call iter%next()
  end do

  _RETURN(ESMF_SUCCESS)

  end subroutine MAPL_IOCountNonDimVars