recursive function ESMF_DELayoutCreateFromPetMap(petMap, keywordEnforcer, &
pinflag, vm, rc)
!
! !RETURN VALUE:
type(ESMF_DELayout) :: ESMF_DELayoutCreateFromPetMap
!
! !ARGUMENTS:
integer, intent(in) :: petMap(:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
type(ESMF_Pin_Flag), intent(in), optional :: pinflag
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} with exactly specified DE to PET mapping.
!
! This ESMF method must be called in unison by all PETs of the VM. Calling
! this method from a PET not part of the VM or not calling it from a PET
! that is part of the VM will result in undefined behavior. ESMF does not
! guard against violation of the unison requirement. The call is not
! collective, there is no communication between PETs.
!
! The arguments are:
! \begin{description}
! \item[petMap]
! List specifying the DE-to-PET mapping. The list elements correspond
! to DE 0, 1, 2, ... and map against the specified PET of the VM
! context. The size of the {\tt petMap}
! argument determines the number of DEs in the created DELayout. It is
! erroneous to specify a PET identifier that lies outside the VM
! context.
! \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[{[vm]}]
! If present, the DELayout object is created on the specified
! {\tt ESMF\_VM} object. The default is to create on the VM of the
! current context.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
!------------------------------------------------------------------------------
integer :: localrc ! local return code
type(ESMF_DELayout) :: delayout ! opaque pointer to new C++ DELayout
integer :: len_petMap ! number of elements in petMap
! 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_DELayoutCreateFromPetMap = delayout
! Check init status of arguments
ESMF_INIT_CHECK_DEEP(ESMF_VMGetInit, vm, rc)
! Set arguments
len_petMap = size(petMap)
! Call into the C++ interface, which will sort out optional arguments
call c_ESMC_DELayoutCreateFromPetMap(delayout, petMap(1), len_petMap, &
pinflag, vm, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Set return value
ESMF_DELayoutCreateFromPetMap = delayout
! Set init code
ESMF_INIT_SET_CREATED(ESMF_DELayoutCreateFromPetMap)
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end function ESMF_DELayoutCreateFromPetMap