test_clear Subroutine

public subroutine test_clear()

Arguments

None

Calls

proc~~test_clear~2~~CallsGraph proc~test_clear~2 test_clear anyexceptions anyexceptions proc~test_clear~2->anyexceptions assert_that assert_that proc~test_clear~2->assert_that asserttrue asserttrue proc~test_clear~2->asserttrue interface~assign_fptr assign_fptr proc~test_clear~2->interface~assign_fptr none~clear~55 MeanAction%clear proc~test_clear~2->none~clear~55 none~initialize~38 AccumulatorAction%initialize proc~test_clear~2->none~initialize~38 proc~destroy_objects destroy_objects proc~test_clear~2->proc~destroy_objects proc~initialize_objects initialize_objects proc~test_clear~2->proc~initialize_objects sourcelocation sourcelocation proc~test_clear~2->sourcelocation none~clear~55->interface~assign_fptr none~clear~154 AccumulatorAction%clear none~clear~55->none~clear~154 proc~mapl_return MAPL_Return none~clear~55->proc~mapl_return proc~mapl_verify MAPL_Verify none~clear~55->proc~mapl_verify esmf_fieldget esmf_fieldget none~initialize~38->esmf_fieldget esmf_stateget esmf_stateget none~initialize~38->esmf_stateget interface~fieldsareconformable FieldsAreConformable none~initialize~38->interface~fieldsareconformable interface~fieldsaresametypekind FieldsAreSameTypeKind none~initialize~38->interface~fieldsaresametypekind interface~mapl_assert MAPL_Assert none~initialize~38->interface~mapl_assert none~initialize~38->none~clear~154 none~create_fields~2 AccumulatorAction%create_fields none~initialize~38->none~create_fields~2 none~initialize~38->proc~mapl_return none~initialize~38->proc~mapl_verify proc~destroy_objects->anyexceptions proc~destroy_objects->assert_that proc~destroy_objects->sourcelocation ESMF_ClockDestroy ESMF_ClockDestroy proc~destroy_objects->ESMF_ClockDestroy ESMF_GridDestroy ESMF_GridDestroy proc~destroy_objects->ESMF_GridDestroy esmf_fielddestroy esmf_fielddestroy proc~destroy_objects->esmf_fielddestroy proc~destroy_objects->esmf_fieldget esmf_statedestroy esmf_statedestroy proc~destroy_objects->esmf_statedestroy proc~get_field~2 get_field proc~destroy_objects->proc~get_field~2 proc~initialize_objects->anyexceptions proc~initialize_objects->assert_that proc~initialize_objects->sourcelocation ESMF_ClockCreate ESMF_ClockCreate proc~initialize_objects->ESMF_ClockCreate ESMF_GridCreateNoPeriDimUfrm ESMF_GridCreateNoPeriDimUfrm proc~initialize_objects->ESMF_GridCreateNoPeriDimUfrm ESMF_TimeIntervalSet ESMF_TimeIntervalSet proc~initialize_objects->ESMF_TimeIntervalSet ESMF_TimeSet ESMF_TimeSet proc~initialize_objects->ESMF_TimeSet esmf_fieldcreate esmf_fieldcreate proc~initialize_objects->esmf_fieldcreate esmf_statecreate esmf_statecreate proc~initialize_objects->esmf_statecreate

Source Code

   subroutine test_clear()
      type(MeanAction) :: acc
      type(ESMF_State) :: importState, exportState
      type(ESMF_Clock) :: clock
      integer :: status
      integer(kind=ESMF_KIND_I4), parameter :: COUNTER = 4
      logical :: cleared = .FALSE.
      integer(kind=ESMF_KIND_I4), pointer :: fptr(:)

      call initialize_objects(importState, exportState, clock, ESMF_TYPEKIND_R4, _RC)
      call acc%initialize(importState, exportState, clock, _RC)
      call assign_fptr(acc%counter_field, fptr, _RC)
      fptr = COUNTER
      call acc%clear(_RC)
      call assign_fptr(acc%counter_field, fptr, _RC)
      cleared = all(fptr == 0)
      @assertTrue(cleared, 'Counter field is nonzero.')
      call destroy_objects(importState, exportState, clock, _RC)

   end subroutine test_clear