test_update Subroutine

public subroutine test_update(this)

Arguments

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

Calls

proc~~test_update~~CallsGraph proc~test_update test_update anyexceptions anyexceptions proc~test_update->anyexceptions assert_that assert_that proc~test_update->assert_that asserttrue asserttrue proc~test_update->asserttrue interface~fieldisconstant FieldIsConstant proc~test_update->interface~fieldisconstant interface~fieldset FieldSet proc~test_update->interface~fieldset none~initialize~30 AccumulatorAction%initialize proc~test_update->none~initialize~30 none~invalidate~2 AccumulatorAction%invalidate proc~test_update->none~invalidate~2 none~update~11 AccumulatorAction%update proc~test_update->none~update~11 proc~destroy_objects destroy_objects proc~test_update->proc~destroy_objects proc~get_field get_field proc~test_update->proc~get_field proc~initialize_objects initialize_objects proc~test_update->proc~initialize_objects sourcelocation sourcelocation proc~test_update->sourcelocation

Source Code

   subroutine test_update(this)
      class(ESMF_TestMethod), intent(inout) :: this
      type(AccumulatorAction) :: acc
      type(ESMF_State) :: importState, exportState
      type(ESMF_Clock) :: clock
      integer :: status
      type(ESMF_Field) :: import_field, export_field
      real(kind=R4), parameter :: invalidate_value = 4.0_R4
      real(kind=R4) :: update_value
      logical :: equals_expected_value

      call initialize_objects(importState, exportState, clock, ESMF_TYPEKIND_R4, _RC)
      call acc%initialize(importState, exportState, clock, _RC)
      call get_field(importState, import_field, _RC)
      call FieldSet(import_field, invalidate_value, _RC)
      call acc%invalidate(importState, exportState, clock, _RC)
      call acc%update(importState, exportState, clock, _RC)
      update_value = invalidate_value
      @assertTrue(acc%update_calculated, 'update_calculated .FALSE.')
      equals_expected_value = FieldIsConstant(acc%accumulation_field, acc%CLEAR_VALUE_R4, _RC)
      @assertTrue(equals_expected_value, 'accumulation_field was not cleared.')
      equals_expected_value = FieldIsConstant(acc%result_field, update_value, _RC)
      @assertTrue(equals_expected_value, 'result_field not equal to update_value')
      call get_field(exportState, export_field, _RC)
      equals_expected_value = FieldIsConstant(export_field, update_value, _RC)
      @assertTrue(equals_expected_value, 'export_field not equal to update_value')

      call acc%invalidate(importState, exportState, clock, _RC)
      call acc%invalidate(importState, exportState, clock, _RC)
      call acc%update(importState, exportState, clock, _RC)
      update_value = 2 * invalidate_value
      @assertTrue(acc%update_calculated, 'update_calculated .FALSE')
      equals_expected_value = FieldIsConstant(acc%accumulation_field, acc%CLEAR_VALUE_R4, _RC)
      @assertTrue(equals_expected_value, 'accumulation_field was not cleared.')
      equals_expected_value = FieldIsConstant(acc%result_field, update_value, _RC)
      @assertTrue(equals_expected_value, 'result_field not equal to update_value.')
      call get_field(exportState, export_field, _RC)
      equals_expected_value = FieldIsConstant(export_field, update_value, _RC)
      @assertTrue(equals_expected_value, 'export_field not equal to update_value')
      call destroy_objects(importState, exportState, clock, _RC)

   end subroutine test_update