recursive function ESMF_DELayoutCreateDeprecated(vmObject, deCountList, &
petList, connectionWeightDimList, cyclicFlagDimList, rc)
!
! !RETURN VALUE:
type(ESMF_DELayout) :: ESMF_DELayoutCreateDeprecated
!
! !ARGUMENTS:
type(ESMF_VM), intent(in) :: vmObject
integer, target, intent(in), optional :: deCountList(:)
integer, target, intent(in), optional :: petList(:)
integer, intent(in), optional :: connectionWeightDimList(:)
type(ESMF_Logical), intent(in), optional :: cyclicFlagDimList(:)
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! Create an N-dimensional, logically rectangular {\tt ESMF\_DELayout}.
! Depending on the optional argument {\tt deCountList} there are two cases
! that can be distinguished:
! \begin{itemize}
! \item If {\tt deCountList} is missing the method will create a
! 1-dimensional 1:1 DE-to-PET layout with as many DEs as there
! are PETs in the VM.
! \item If {\tt deCountList} is present the method will create an
! N-dimensional layout, where N is equal to the the size of {\tt
! deCountList}. The number of DEs will be {\tt deCountList(1)}
! $\times$
! {\tt deCountList(2)} $\times$ ... $\times$ {\tt deCountList(N)}.
! The DE labeling sequence follows column major order for the
! {\tt deCountList} argument. For example {\tt deCountList=(/2, 3/)}
! would result in the following DE labels:
! \begin{verbatim}
! --------------> 2nd dimension
! | +---+---+---+
! | | 0 | 2 | 4 |
! | +---+---+---+
! | | 1 | 3 | 5 |
! | +---+---+---+
! |
! v
! 1st dimension
! \end{verbatim}
! \end{itemize}
!
! In either case, if the {\tt petList} argument is given and its size is
! equal to the number of DEs in the created {\tt ESMF\_DELayout}, it will
! be used to determine the DE-to-PET mapping. The list elements correspond
! to DE 0, 1, 2, ... and assign the specified PET to the respective DE. If
! {\tt petList} is not present, or is of incompatible size, a default
! DE-to-PET mapping will be chosen.
!
! The {\tt connectionWeightDimList} argument, if present, must have N
! entries which will be used to ascribe connection weights along each
! dimension within the {\tt ESMF\_DELayout}. These weights have values from
! 0 to 100 and will be used to find the best match between an
! {\tt ESMF\_DELayout} and the {\tt ESMF\_VM}.
!
! The {\tt cyclicFlagDimList} argument allows to enforce cyclic boundaries
! in each of the dimensions of {\tt ESMF\_DELayout}. If present its size
! must be equal to the number of DEs in the {\tt ESMF\_DELayout}. ({\it Not
! yet implemented feature!}) \newline
!
! The arguments are:
! \begin{description}
! \item[vmObject]
! {\tt ESMF\_VM} object of the current component in which the
! {\tt ESMF\_DELayout} object shall operate.
! \item[{[deCountList]}]
! List DE count in each dimension.
! \item[{[petList]}]
! List specifying DE-to-PET mapping. The list elements correspond to
! DE 0, 1, 2, ... and assign the specified PET to the respective DE.
! \item[{[connectionWeightDimList]}]
! List of connection weights along each dimension.
! (UNIMPLEMENTED!)
! \item[{[cyclicFlagDimList]}]
! List of flags indicating cyclic boundaries in each dimension.
! (UNIMPLEMENTED!)
! \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
integer :: len_deCountList, len_petList
integer, pointer :: opt_deCountList(:), opt_petList(:)
integer, target :: dummy(1) ! used to satisfy the C interface...
! 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_DELayoutCreateDeprecated = delayout
! Check init status of arguments
ESMF_INIT_CHECK_DEEP(ESMF_VMGetInit, vmObject, rc)
! Deal with optional array arguments
if (present(deCountList)) then
len_deCountList = size(deCountList)
opt_deCountList => deCountList
else
len_deCountList = 0
opt_deCountList => dummy
endif
if (present(petList)) then
len_petList = size(petList)
opt_petList => petList
else
len_petList = 0
opt_petList => dummy
endif
! Not implemented features
if (present(connectionWeightDimList)) then
call ESMF_LogSetError(rcToCheck=ESMF_RC_NOT_IMPL, &
msg="- connectionWeightDimList not implemented", &
ESMF_CONTEXT, rcToReturn=rc)
return
endif
if (present(cyclicFlagDimList)) then
call ESMF_LogSetError(rcToCheck=ESMF_RC_NOT_IMPL, &
msg="- cyclicFlagDimList not implemented", &
ESMF_CONTEXT, rcToReturn=rc)
return
endif
! Call into the C++ interface.
call c_ESMC_DELayoutCreateND(delayout, vmObject, opt_deCountList(1), &
len_deCountList, opt_petList(1), len_petList, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Set return value
ESMF_DELayoutCreateDeprecated = delayout
! Set init code
ESMF_INIT_SET_CREATED(ESMF_DELayoutCreateDeprecated)
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end function ESMF_DELayoutCreateDeprecated