ESMF_DELayoutCreateDefault Function

private recursive function ESMF_DELayoutCreateDefault(keywordEnforcer, deCount, deGrouping, pinflag, petList, vm, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(in), optional :: deCount
integer, intent(in), optional, target :: deGrouping(:)
type(ESMF_Pin_Flag), intent(in), optional :: pinflag
integer, intent(in), optional, target :: petList(:)
type(ESMF_VM), intent(in), optional :: vm
integer, intent(out), optional :: rc

Return Value type(ESMF_DELayout)


Source Code

  recursive function ESMF_DELayoutCreateDefault(keywordEnforcer, deCount, &
    deGrouping, pinflag, petList, vm, rc)
!         
! !RETURN VALUE:
    type(ESMF_DELayout) :: ESMF_DELayoutCreateDefault
!
! !ARGUMENTS:
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    integer,                      intent(in),  optional :: deCount
    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} object on the basis of optionally provided
!     restrictions. By default a DELayout with deCount equal to petCount will
!     be created, each DE mapped to a single PET. However, the number of DEs
!     as well grouping of DEs and PETs can be specified via the optional
!     arguments.
!
!     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[{[deGrouping]}]
!          This optional argument must be of size deCount. Its content assigns
!          a DE group index to each DE of the DELayout. A group index of -1 
!          indicates that the associated DE isn't member of any particular 
!          group. The significance of DE groups is that all the DEs belonging
!          to a certain group will be mapped against the {\em same} PET. This
!          does not, however, mean that DEs belonging to different DE groups 
!          must be mapped to different PETs.
!     \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]}]
!          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  
    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_DELayoutCreateDefault = 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
    
    ! 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_DELayoutCreateDefault = 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_DELayoutCreateDefault)
 
    ! return successfully
    if (present(rc)) rc = ESMF_SUCCESS
 
  end function ESMF_DELayoutCreateDefault