test_reset_empty Subroutine

public subroutine test_reset_empty(this)

Arguments

Type IntentOptional Attributes Name
class(ESMF_TestMethod), intent(inout) :: this

Calls

proc~~test_reset_empty~~CallsGraph proc~test_reset_empty test_reset_empty ESMF_GeomCreate ESMF_GeomCreate proc~test_reset_empty->ESMF_GeomCreate ESMF_GeomDestroy ESMF_GeomDestroy proc~test_reset_empty->ESMF_GeomDestroy ESMF_GridCreateNoPeriDim ESMF_GridCreateNoPeriDim proc~test_reset_empty->ESMF_GridCreateNoPeriDim ESMF_GridDestroy ESMF_GridDestroy proc~test_reset_empty->ESMF_GridDestroy anyexceptions anyexceptions proc~test_reset_empty->anyexceptions assert_that assert_that proc~test_reset_empty->assert_that esmf_fielddestroy esmf_fielddestroy proc~test_reset_empty->esmf_fielddestroy esmf_fieldemptyset esmf_fieldemptyset proc~test_reset_empty->esmf_fieldemptyset esmf_fieldget esmf_fieldget proc~test_reset_empty->esmf_fieldget interface~mapl_fieldcreate~2 MAPL_FieldCreate proc~test_reset_empty->interface~mapl_fieldcreate~2 interface~mapl_fieldemptycomplete MAPL_FieldEmptyComplete proc~test_reset_empty->interface~mapl_fieldemptycomplete interface~mapl_fieldreset MAPL_FieldReset proc~test_reset_empty->interface~mapl_fieldreset sourcelocation sourcelocation proc~test_reset_empty->sourcelocation true true proc~test_reset_empty->true

Source Code

   subroutine test_reset_empty(this)
      class(ESMF_TestMethod), intent(inout) :: this
      type(ESMF_Field) :: field
      type(ESMF_Geom) :: geom
      type(ESMF_Grid) :: grid
      character(*), parameter :: EXPECTED_UNITS = 'km'

      integer :: status
      type(ESMF_FieldStatus_Flag) :: field_status
      type(ESMF_TypeKind_Flag) :: typekind

      grid = ESMF_GridCreateNoPeriDim(maxIndex=[4,4], _RC)
      geom = ESMF_GeomCreate(grid, _RC)
      
      field = MAPL_FieldCreate(geom, typekind=ESMF_TYPEKIND_R4, units=EXPECTED_UNITS, _RC)

      call MAPL_FieldReset(field, new_status=ESMF_FIELDSTATUS_EMPTY, _RC)
      call ESMF_FieldGet(field, status=field_status, _RC)
      @assert_that(field_status == ESMF_FIELDSTATUS_EMPTY, is(true()))

      call ESMF_FieldEmptySet(field, geom=geom, _RC)
      call ESMF_FieldGet(field, status=field_status, _RC)
      @assert_that(field_status == ESMF_FIELDSTATUS_GRIDSET, is(true()))

      ! Can we complete the field now?
      call MAPL_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, _RC)
      call ESMF_FieldGet(field, status=field_status, typekind=typekind, _RC)
      @assert_that(field_status == ESMF_FIELDSTATUS_COMPLETE, is(true()))
      @assert_that(typekind == ESMF_TYPEKIND_R8, is(true()))

      call ESMF_FieldDestroy(field, _RC)
      call ESMF_GridDestroy(grid, _RC)
      call ESMF_GeomDestroy(geom, _RC)
      _UNUSED_DUMMY(this)
   end subroutine test_reset_empty