get_accumulator_action Subroutine

public subroutine get_accumulator_action(accumulation_type, typekind, action, rc)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: accumulation_type
type(ESMF_TypeKind_Flag), intent(in) :: typekind
class(ExtensionAction), intent(out), allocatable :: action
integer, intent(out), optional :: rc

Calls

proc~~get_accumulator_action~~CallsGraph proc~get_accumulator_action get_accumulator_action interface~mapl_assert MAPL_Assert proc~get_accumulator_action->interface~mapl_assert proc~mapl_return MAPL_Return proc~get_accumulator_action->proc~mapl_return at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception

Source Code

   subroutine get_accumulator_action(accumulation_type, typekind, action, rc)
      character(len=*), intent(in) :: accumulation_type
      type(ESMF_TypeKind_Flag), intent(in) :: typekind
      class(ExtensionAction), allocatable, intent(out) :: action
      integer, optional, intent(out) :: rc 

      integer :: status

      allocate(action, source=NullAction())

      if(typekind /= ESMF_TYPEKIND_R4) then
         _FAIL('Unsupported typekind')
      end if

      select case(accumulation_type)
      case (SIMPLE_ACCUMULATION)
         allocate(action, source=AccumulatorAction(typekind))
      case (MEAN_ACCUMULATION)
         allocate(action, source=MeanAction(typekind))
      case (MAX_ACCUMULATION)
         allocate(action, source=MaxAction(typekind))
      case (MIN_ACCUMULATION)
         allocate(action, source=MinAction(typekind))
      case (INSTANTANEOUS)
         _FAIL('No AccumulatorAction for instantaneous.')
      case default
         _FAIL('Unsupported AccumulatorAction')
      end select

      _RETURN(_SUCCESS)

   end subroutine get_accumulator_action