Test_MinAction.pf Source File


This file depends on

sourcefile~~test_minaction.pf~~EfferentGraph sourcefile~test_minaction.pf Test_MinAction.pf sourcefile~accumulator_action_test_common.f90 accumulator_action_test_common.F90 sourcefile~test_minaction.pf->sourcefile~accumulator_action_test_common.f90 sourcefile~fieldutils.f90 FieldUtils.F90 sourcefile~test_minaction.pf->sourcefile~fieldutils.f90 sourcefile~minaction.f90 MinAction.F90 sourcefile~test_minaction.pf->sourcefile~minaction.f90 sourcefile~accumulator_action_test_common.f90->sourcefile~fieldutils.f90 sourcefile~internalconstants.f90 InternalConstants.F90 sourcefile~accumulator_action_test_common.f90->sourcefile~internalconstants.f90 sourcefile~fieldbinaryoperations.f90 FieldBinaryOperations.F90 sourcefile~fieldutils.f90->sourcefile~fieldbinaryoperations.f90 sourcefile~fieldblas.f90 FieldBLAS.F90 sourcefile~fieldutils.f90->sourcefile~fieldblas.f90 sourcefile~fieldpointerutilities.f90 FieldPointerUtilities.F90 sourcefile~fieldutils.f90->sourcefile~fieldpointerutilities.f90 sourcefile~fieldunaryfunctions.f90 FieldUnaryFunctions.F90 sourcefile~fieldutils.f90->sourcefile~fieldunaryfunctions.f90 sourcefile~fieldutilities.f90 FieldUtilities.F90 sourcefile~fieldutils.f90->sourcefile~fieldutilities.f90 sourcefile~accumulatoraction.f90 AccumulatorAction.F90 sourcefile~minaction.f90->sourcefile~accumulatoraction.f90 sourcefile~minaction.f90->sourcefile~fieldpointerutilities.f90 sourcefile~minaction.f90->sourcefile~internalconstants.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~minaction.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~accumulatoraction.f90->sourcefile~fieldpointerutilities.f90 sourcefile~accumulatoraction.f90->sourcefile~fieldutilities.f90 sourcefile~accumulatoraction.f90->sourcefile~internalconstants.f90 sourcefile~accumulatoraction.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~extensionaction.f90 ExtensionAction.F90 sourcefile~accumulatoraction.f90->sourcefile~extensionaction.f90 sourcefile~fieldbinaryoperations.f90->sourcefile~fieldpointerutilities.f90 sourcefile~fieldbinaryoperations.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~fieldblas.f90->sourcefile~fieldpointerutilities.f90 sourcefile~fieldblas.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~fieldpointerutilities.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~fieldunaryfunctions.f90->sourcefile~fieldpointerutilities.f90 sourcefile~fieldunaryfunctions.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~fieldutilities.f90->sourcefile~fieldpointerutilities.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~fieldutilities.f90->sourcefile~errorhandling.f90 sourcefile~fieldinfo.f90 FieldInfo.F90 sourcefile~fieldutilities.f90->sourcefile~fieldinfo.f90 sourcefile~infoutilities.f90 InfoUtilities.F90 sourcefile~fieldutilities.f90->sourcefile~infoutilities.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~fieldutilities.f90->sourcefile~keywordenforcer.f90 sourcefile~lu_bound.f90 LU_Bound.F90 sourcefile~fieldutilities.f90->sourcefile~lu_bound.f90 sourcefile~ungriddeddims.f90 UngriddedDims.F90 sourcefile~fieldutilities.f90->sourcefile~ungriddeddims.f90 sourcefile~mapl_exceptionhandling.f90->sourcefile~errorhandling.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~mapl_exceptionhandling.f90->sourcefile~mapl_throw.f90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~extensionaction.f90->sourcefile~errorhandling.f90 sourcefile~fieldinfo.f90->sourcefile~errorhandling.f90 sourcefile~fieldinfo.f90->sourcefile~infoutilities.f90 sourcefile~fieldinfo.f90->sourcefile~keywordenforcer.f90 sourcefile~fieldinfo.f90->sourcefile~ungriddeddims.f90 sourcefile~mapl_esmf_infokeys.f90 MAPL_ESMF_InfoKeys.F90 sourcefile~fieldinfo.f90->sourcefile~mapl_esmf_infokeys.f90 sourcefile~verticalstaggerloc.f90 VerticalStaggerLoc.F90 sourcefile~fieldinfo.f90->sourcefile~verticalstaggerloc.f90 sourcefile~infoutilities.f90->sourcefile~errorhandling.f90 sourcefile~infoutilities.f90->sourcefile~keywordenforcer.f90 sourcefile~infoutilities.f90->sourcefile~mapl_esmf_infokeys.f90 sourcefile~ungriddeddims.f90->sourcefile~errorhandling.f90 sourcefile~ungriddeddims.f90->sourcefile~infoutilities.f90 sourcefile~ungriddeddims.f90->sourcefile~lu_bound.f90 sourcefile~ungriddeddims.f90->sourcefile~mapl_esmf_infokeys.f90 sourcefile~ungriddeddim.f90 UngriddedDim.F90 sourcefile~ungriddeddims.f90->sourcefile~ungriddeddim.f90 sourcefile~ungriddeddimvector.f90 UngriddedDimVector.F90 sourcefile~ungriddeddims.f90->sourcefile~ungriddeddimvector.f90

Source Code

#include "MAPL_TestErr.h"
module Test_MinAction
   use mapl3g_MinAction
   use accumulator_action_test_common
   use esmf
   use funit
   use MAPL_FieldUtils
   implicit none

contains

   @Test
   subroutine test_min_accumulate_R4()
      type(MinAction) :: acc
      type(ESMF_State) :: importState, exportState
      type(ESMF_Clock) :: clock
      integer :: status
      type(ESMF_Field) :: update_field
      type(ESMF_TypeKind_Flag), parameter :: tk =ESMF_TYPEKIND_R4
      real(kind=ESMF_KIND_R4), pointer :: upPtr(:), accPtr(:)
      real(kind=ESMF_KIND_R4), parameter :: UPDATE_VALUE = 1.0_R4, ACCUMULATED_VALUE = 3.0_R4
      real(kind=ESMF_KIND_R4) :: undef_value
      real(kind=ESMF_KIND_R4), allocatable :: expected(:)
      integer :: i, n

      ! Initialize
      call set_undef(undef_value)
      call initialize_objects(importState, exportState, clock, tk, _RC)
      call acc%initialize(importState, exportState, clock, _RC)
      call initialize_field(update_field, typekind=tk, _RC)
      call assign_fptr(acc%accumulation_field, accPtr, _RC)
      call assign_fptr(update_field, upPtr, _RC)
      n = size(upPtr)
      i = n - 3
      accPtr(i:n) = [undef_value, ACCUMULATED_VALUE, ACCUMULATED_VALUE, ACCUMULATED_VALUE]
      upPtr(i:n) = [UPDATE_VALUE, undef_value, UPDATE_VALUE, UPDATE_VALUE+ACCUMULATED_VALUE]
      expected = [UPDATE_VALUE, ACCUMULATED_VALUE, UPDATE_VALUE, ACCUMULATED_VALUE]
      call acc%accumulate_R4(update_field, _RC)
      @assertEqual(expected, accPtr, 'accumulated_field not equal to expected values')
      call ESMF_FieldDestroy(update_field, _RC)
      call destroy_objects(importState, exportState, clock, _RC)

   end subroutine test_min_accumulate_R4

end module Test_MinAction