Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ESMF_TestMethod), | intent(inout) | :: | this |
subroutine test_accumulate_mean_R4(this) class(ESMF_TestMethod), intent(inout) :: this type(MeanAction) :: acc type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock integer :: status real(kind=ESMF_KIND_R4), parameter :: UPDATE_VALUE = 3.0_R4 type(ESMF_Field) :: update_field real(kind=ESMF_KIND_R4), pointer :: upPtr(:) => null() real(kind=ESMF_KIND_R4), pointer :: accPtr(:) => null() integer(kind=I4), pointer :: countPtr(:) => null() integer(kind=I4), allocatable :: expected_count(:) integer :: n call initialize_objects(importState, exportState, clock, ESMF_TYPEKIND_R4, _RC) call acc%initialize(importState, exportState, clock, _RC) call initialize_field(update_field, acc%accumulation_field, _RC) ! set update field call FieldSet(update_field, UPDATE_VALUE, _RC) call assign_fptr(update_field, upPtr, _RC) ! set last element of update field to UNDEF n = size(upPtr) call set_undef(upPtr(n)) ! run subroutine to test call acc%accumulate_R4(update_field, _RC) call assign_fptr(acc%accumulation_field, accPtr, _RC) call assign_fptr(acc%counter_field, countPtr, _RC) allocate(expected_count(size(countPtr))) expected_count = 1_I4 expected_count(n) = 0_I4 @assertEqual(expected_count, countPtr, 'Counts do not match.') call ESMF_FieldDestroy(update_field) call destroy_objects(importState, exportState, clock, _RC) end subroutine test_accumulate_mean_R4