check_field_status Subroutine

public subroutine check_field_status(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_field_status~~CallsGraph proc~check_field_status check_field_status anyexceptions anyexceptions proc~check_field_status->anyexceptions assert_that assert_that proc~check_field_status->assert_that esmf_fieldget esmf_fieldget proc~check_field_status->esmf_fieldget esmf_hconfigasstring esmf_hconfigasstring proc~check_field_status->esmf_hconfigasstring esmf_stateget esmf_stateget proc~check_field_status->esmf_stateget sourcelocation sourcelocation proc~check_field_status->sourcelocation true true proc~check_field_status->true

Source Code

   subroutine check_field_status(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

      character(len=:), allocatable :: expected_field_status_str
      type(ESMF_FieldStatus_Flag) :: expected_field_status
      type(ESMF_FieldStatus_Flag) :: found_field_status
      type(ESMF_StateItem_Flag) :: itemtype
      type(ESMF_Field) :: field
      integer :: status
      character(len=:), allocatable :: msg


      msg = short_name // ':: '// description

      call ESMF_StateGet(state, short_name, itemtype=itemtype, _RC)
      if (itemtype /= ESMF_STATEITEM_FIELD) then
         rc = 0
         return
      end if

      expected_field_status_str = ESMF_HConfigAsString(expectations,keyString='status',_RC)
      expected_field_status = ESMF_FIELDSTATUS_GRIDSET
      select case (expected_field_status_str)
      case ('complete')
         expected_field_status = ESMF_FIELDSTATUS_COMPLETE
      case ('gridset')
         expected_field_status = ESMF_FIELDSTATUS_GRIDSET
      case ('empty')
         expected_field_status = ESMF_FIELDSTATUS_EMPTY
      case default
         _VERIFY(-1)
      end select

      call ESMF_StateGet(state, short_name, field, _RC)
      call ESMF_FieldGet(field, status=found_field_status, _RC)
      @assert_that(msg // ' field status: ',expected_field_status == found_field_status, is(true()))

      rc = 0
   end subroutine check_field_status