subroutine ESMF_ArrayBundleSMMStoreI4(srcArrayBundle, dstArrayBundle, &
routehandle, factorList, factorIndexList, keywordEnforcer, &
ignoreUnmatchedIndicesFlag, srcTermProcessing, rc)
!
! !ARGUMENTS:
type(ESMF_ArrayBundle), intent(in) :: srcArrayBundle
type(ESMF_ArrayBundle), intent(inout) :: dstArrayBundle
type(ESMF_RouteHandle), intent(inout) :: routehandle
integer(ESMF_KIND_I4), target, intent(in) :: factorList(:)
integer, intent(in) :: factorIndexList(:,:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
logical, intent(in), optional :: ignoreUnmatchedIndicesFlag(:)
integer, intent(inout), optional :: srcTermProcessing(:)
integer, intent(out), optional :: rc
!
!EOPI
!------------------------------------------------------------------------------
integer :: localrc ! local return code
integer(ESMF_KIND_I4), pointer :: opt_factorList(:) ! helper variable
integer :: len_factorList ! helper variable
type(ESMF_InterArray) :: factorIndexListArg ! helper variable
type(ESMF_Logical), pointer :: opt_ignoreUnmatched(:)
type(ESMF_Logical), target :: def_ignoreUnmatched(1)
integer :: len_ignoreUnmatched
type(ESMF_InterArray) :: srcTermProcessingArg ! helper variable
! initialize return code; assume routine not implemented
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Check init status of arguments
ESMF_INIT_CHECK_DEEP_SHORT(ESMF_ArrayBundleGetInit, srcArrayBundle, rc)
ESMF_INIT_CHECK_DEEP_SHORT(ESMF_ArrayBundleGetInit, dstArrayBundle, rc)
! Wrap factor arguments
len_factorList = size(factorList)
opt_factorList => factorList
factorIndexListArg = &
ESMF_InterArrayCreate(farray2D=factorIndexList, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Deal with ignoreUnmatchedIndicesFlag
def_ignoreUnmatched(1) = .false.
if (present(ignoreUnmatchedIndicesFlag)) then
if (size(ignoreUnmatchedIndicesFlag)==0) then
call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
msg="Size of 'ignoreUnmatchedIndicesFlag' argument must not be zero.",&
ESMF_CONTEXT, rcToReturn=rc)
return ! bail out
endif
allocate(opt_ignoreUnmatched(size(ignoreUnmatchedIndicesFlag)))
opt_ignoreUnmatched(:) = ignoreUnmatchedIndicesFlag(:)
else
opt_ignoreUnmatched => def_ignoreUnmatched
endif
len_ignoreUnmatched = size(opt_ignoreUnmatched)
! Wrap srcTermProcessing argument
srcTermProcessingArg = &
ESMF_InterArrayCreate(srcTermProcessing, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Call into the C++ interface, which will sort out optional arguments
call c_ESMC_ArrayBundleSMMStore(srcArrayBundle, dstArrayBundle, &
routehandle, ESMF_TYPEKIND_I4, opt_factorList, len_factorList, &
factorIndexListArg, opt_ignoreUnmatched(1), len_ignoreUnmatched, &
srcTermProcessingArg, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Garbage collection
call ESMF_InterArrayDestroy(factorIndexListArg, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
if (present(ignoreUnmatchedIndicesFlag)) then
deallocate(opt_ignoreUnmatched)
endif
! Mark routehandle object as being created
call ESMF_RouteHandleSetInitCreated(routehandle, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_ArrayBundleSMMStoreI4