check_fieldCount Subroutine

public subroutine check_fieldCount(expectations, state, short_name, description, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_HConfig), intent(in) :: expectations
type(ESMF_State), intent(inout) :: state
character(len=*), intent(in) :: short_name
character(len=*), intent(in) :: description
integer, intent(out) :: rc

Calls

proc~~check_fieldcount~~CallsGraph proc~check_fieldcount check_fieldCount anyexceptions anyexceptions proc~check_fieldcount->anyexceptions assert_that assert_that proc~check_fieldcount->assert_that esmf_fieldbundleget esmf_fieldbundleget proc~check_fieldcount->esmf_fieldbundleget esmf_hconfigasi4 esmf_hconfigasi4 proc~check_fieldcount->esmf_hconfigasi4 esmf_hconfigisdefined esmf_hconfigisdefined proc~check_fieldcount->esmf_hconfigisdefined esmf_stateget esmf_stateget proc~check_fieldcount->esmf_stateget sourcelocation sourcelocation proc~check_fieldcount->sourcelocation

Source Code

   subroutine check_fieldCount(expectations, state, short_name, description, rc)
      type(ESMF_HConfig), intent(in) :: expectations
      type(ESMF_State), intent(inout) :: state
      character(*), intent(in) :: short_name
      character(*), intent(in) :: description
      integer, intent(out) :: rc

      integer :: status
      character(len=:), allocatable :: msg
      integer :: found_fieldCount, expected_fieldCount
      type(ESMF_FieldBundle) :: bundle
      type(ESMF_StateItem_Flag) :: itemtype

      msg = description

      rc = 0

      call ESMF_StateGet(state, short_name, itemtype=itemtype)
      if (itemtype /= ESMF_STATEITEM_FIELDBUNDLE) return ! that's ok

      if (.not. ESMF_HConfigIsDefined(expectations,keyString='fieldcount')) return

      expected_fieldCount = ESMF_HConfigAsI4(expectations,keyString='fieldcount',_RC)
      call ESMF_StateGet(state, short_name, bundle, _RC)
      call ESMF_FieldBundleGet(bundle, fieldCount=found_fieldCount, _RC)

      @assert_that(found_fieldCount, is(expected_fieldCount))
   end subroutine check_fieldCount