Type | Intent | Optional | 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 |
subroutine check_field_typekind(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_typekind_str type(ESMF_TypeKind_Flag) :: expected_field_typekind type(ESMF_TypeKind_Flag) :: found_field_typekind type(ESMF_StateItem_Flag) :: itemtype integer :: status character(len=:), allocatable :: msg type(ESMF_Field) :: field msg = description call ESMF_StateGet(state, short_name, itemtype=itemtype, _RC) if (itemtype /= ESMF_STATEITEM_FIELD) then rc = 0 return end if if (.not. ESMF_HConfigIsDefined(expectations,keyString='typekind')) then rc = 0 return end if expected_field_typekind_str = ESMF_HConfigAsString(expectations,keyString='typekind',_RC) select case (expected_field_typekind_str) case ('R4') expected_field_typekind = ESMF_TYPEKIND_R4 case ('R8') expected_field_typekind = ESMF_TYPEKIND_R8 case default _VERIFY(-1) end select call ESMF_StateGet(state, short_name, field, _RC) call ESMF_FieldGet(field, typekind=found_field_typekind, _RC) @assert_that(msg // ' field typekind: ',expected_field_typekind == found_field_typekind, is(true())) rc = 0 end subroutine check_field_typekind