recursive function ESMF_DELayoutCreateHintWeights(keywordEnforcer, deCount, &
compWeights, commWeights, deGrouping, pinflag, petList, vm, rc)
!
! !RETURN VALUE:
type(ESMF_DELayout) :: ESMF_DELayoutCreateHintWeights
!
! !ARGUMENTS:
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, intent(in), optional :: deCount
integer, intent(in) :: compWeights(:)
integer, intent(in) :: commWeights(:,:)
integer, target, intent(in), optional :: deGrouping(:)
type(ESMF_Pin_Flag), intent(in), optional :: pinflag
integer, target, intent(in), optional :: petList(:)
type(ESMF_VM), intent(in), optional :: vm
integer, intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
! Create an {\tt ESMF\_DELayout} on the basis of computational and
! communication weights. In addition this call provides control over the
! number of DEs, DE domains, DE pinning and the PETs to
! map against.
!
! The arguments are:
! \begin{description}
! \item[{[deCount]}]
! Number of DEs to be provided by the created DELayout. By default
! the number of DEs equals the number of PETs in the associated VM
! context. Specifying a {\tt deCount} smaller than the number
! of PETs will result in unassociated PETs.
! This may be used to share VM resources between DELayouts within the
! same ESMF component. Specifying a {\tt deCount} greater than the
! number of PETs will result in multiple DE to PET mapping.
! \item[compWeights]
! This argument provides the computational weight hint. The
! {\tt compWeights} list must contain at least {\tt deCount} elements
! and specifies a relative measure of the computational weight for each
! DE in form of an integer number. The weights are a relative measure
! and only meaningful when compared to weights of the same DELayout.
! (UNIMPLEMENTED!)
! \item[commWeights]
! This argument provides the communication weight hint.
! {\tt commWeights} is a 2D array and must contain at least
! {\tt deCount} elements in each dimension. The element indices
! correspond to the DEs of the DELayout and each element specifies a
! relative communication weight for a DE pair. The {\tt commWeight}
! matrix must be symmetric and diagonal elements are ignored. The
! weights are a relative measure and only meaningful when compared to
! weights of the same DELayout.
! (UNIMPLEMENTED!)
! \item[{[pinflag]}]
! This flag specifies which type of resource DEs are pinned to.
! The default is to pin DEs to PETs. Alternatively it is
! also possible to pin DEs to VASs. See section
! \ref{const:pin_flag} for a list of valid pinning options.
! \item[{[petList]}]
! List specifying PETs to be used by this DELayout. This can be used
! to control the PET overlap between DELayouts within the same
! ESMF component. It is erroneous to specify PETs that are not within
! the provided VM context. The default is to include all the PETs of
! the VM.
! \item[{[vm]}]
! Optional {\tt ESMF\_VM} object of the current context. Providing the
! VM of the current context will lower the method's overhead.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI
!------------------------------------------------------------------------------
integer :: localrc ! local return code
type(ESMF_DELayout) :: delayout ! opaque pointer to new C++ DELayout
type(ESMF_InterArray) :: deGroupingArg
type(ESMF_InterArray) :: petListArg
! initialize return code; assume routine not implemented
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Mark this DELayout as invalid
delayout%this = ESMF_NULL_POINTER
ESMF_DELayoutCreateHintWeights = delayout
! Check init status of arguments
ESMF_INIT_CHECK_DEEP(ESMF_VMGetInit, vm, rc)
! Deal with optional array arguments
deGroupingArg = ESMF_InterArrayCreate(deGrouping, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
petListArg = ESMF_InterArrayCreate(petList, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
!DUMMY TEST TO QUIET DOWN COMPILER WARNINGS
!TODO: Remove the following dummy test when dummy argument actually used
if (size(compWeights) == size(compWeights)) continue
!DUMMY TEST TO QUIET DOWN COMPILER WARNINGS
!TODO: Remove the following dummy test when dummy argument actually used
if (size(commWeights) == size(commWeights)) continue
!TODO: use the correct C++ implementation once it is available
! Call into the C++ interface, which will sort out optional arguments
call c_ESMC_DELayoutCreateDefault(delayout, deCount, deGroupingArg, &
pinflag, petListArg, vm, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Set return value
ESMF_DELayoutCreateHintWeights = delayout
! Garbage collection
call ESMF_InterArrayDestroy(deGroupingArg, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(petListArg, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Set init code
ESMF_INIT_SET_CREATED(ESMF_DELayoutCreateHintWeights)
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end function ESMF_DELayoutCreateHintWeights