subroutine ESMF_DistGridGetDefault(distgrid, keywordEnforcer, delayout, &
dimCount, tileCount, deCount, localDeCount, minIndexPTile, maxIndexPTile, &
elementCountPTile, elementCountPTileI8, minIndexPDe, maxIndexPDe, &
elementCountPDe, elementCountPDeI8, localDeToDeMap, deToTileMap, &
indexCountPDe, collocation, regDecompFlag, indexTK, indexflag, &
connectionCount, connectionList, rc)
!
! !ARGUMENTS:
type(ESMF_DistGrid), intent(in) :: distgrid
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
type(ESMF_DELayout), intent(out), optional :: delayout
integer, intent(out), optional :: dimCount
integer, intent(out), optional :: tileCount
integer, intent(out), optional :: deCount
integer, intent(out), optional :: localDeCount
integer, target, intent(out), optional :: minIndexPTile(:,:)
integer, target, intent(out), optional :: maxIndexPTile(:,:)
integer, target, intent(out), optional :: elementCountPTile(:)
integer(ESMF_KIND_I8),target, intent(out), optional :: elementCountPTileI8(:)
integer, target, intent(out), optional :: minIndexPDe(:,:)
integer, target, intent(out), optional :: maxIndexPDe(:,:)
integer, target, intent(out), optional :: elementCountPDe(:)
integer(ESMF_KIND_I8),target, intent(out), optional :: elementCountPDeI8(:)
integer, target, intent(out), optional :: localDeToDeMap(:)
integer, target, intent(out), optional :: deToTileMap(:)
integer, target, intent(out), optional :: indexCountPDe(:,:)
integer, target, intent(out), optional :: collocation(:)
logical, intent(out), optional :: regDecompFlag
type(ESMF_TypeKind_Flag), intent(out), optional :: indexTK
type(ESMF_Index_Flag), intent(out), optional :: indexflag
integer, intent(out), optional :: connectionCount
type(ESMF_DistGridConnection), &
target, intent(out), optional :: connectionList(:)
integer, intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \item\apiStatusModifiedSinceVersion{5.2.0r}
! \begin{description}
! \item[7.0.0] Added argument {\tt deCount} to simplify access to this
! variable. \newline
! Added arguments {\tt connectionCount} and {\tt connectionList}
! to provide user access to the explicitly defined connections in
! a DistGrid.
! \item[8.0.0] Added arguments {\tt localDeCount} and {\tt localDeToDeMap}
! to simplify access to these variables.
! \item[8.1.0] Added argument {\tt indexTK} to allow query of the sequence index
! typekind.\newline
! Added arguments {\tt elementCountPTileI8} and
! {\tt elementCountPDeI8} to provide 64-bit access.\newline
! Added argument {\tt indexflag} to allow user to query this
! setting.
! \end{description}
! \end{itemize}
!
! !DESCRIPTION:
! Access internal DistGrid information.
!
! The arguments are:
! \begin{description}
! \item[distgrid]
! Queried {\tt ESMF\_DistGrid} object.
! \item[{[delayout]}]
! {\tt ESMF\_DELayout} object associated with {\tt distgrid}.
! \item[{[dimCount]}]
! Number of dimensions (rank) of {\tt distgrid}.
! \item[{[tileCount]}]
! Number of tiles in {\tt distgrid}.
! \item[{[deCount]}]
! Number of DEs in the DELayout in {\tt distgrid}.
! \item[{[localDeCount]}]
! Number of local DEs in the DELayout in {\tt distgrid} on this PET.
! \item[{[minIndexPTile]}]
! \begin{sloppypar}
! Lower index space corner per tile. Must enter
! allocated with {\tt shape(minIndexPTile) == (/dimCount, tileCount/)}.
! \item[{[maxIndexPTile]}]
! Upper index space corner per tile. Must enter
! allocated with {\tt shape(maxIndexPTile) == (/dimCount, tileCount/)}.
! \item[{[elementCountPTile]}]
! Number of elements in the exclusive region per tile. Must enter
! allocated with {\tt shape(elementCountPTile) == (/tileCount/)}.
! An error will be returned if any of the counts goes above the 32-bit
! limit.
! \item[{[elementCountPTileI8]}]
! Same as {\tt elementCountPTile}, but of 64-bit integer kind.
! \item[{[minIndexPDe]}]
! Lower index space corner per DE. Must enter
! allocated with {\tt shape(minIndexPDe) == (/dimCount, deCount/)}.
! \item[{[maxIndexPDe]}]
! Upper index space corner per DE. Must enter
! allocated with {\tt shape(maxIndexPDe) == (/dimCount, deCount/)}.
! \item[{[elementCountPDe]}]
! Number of elements in the exclusive region per DE. Must enter
! allocated with {\tt shape(elementCountPDe) == (/deCount/)}.
! An error will be returned if any of the counts goes above the 32-bit
! limit.
! \item[{[elementCountPDeI8]}]
! Same as {\tt elementCountPDe}, but of 64-bit integer kind.
! \item[{[localDeToDeMap]}]
! Global DE index for each local DE. Must enter allocated with
! {\tt shape(localDeToDeMap) == (/localDeCount/)}. It is recommended to
! use a lower bound of 0 for {\tt localDeToDeMap}, in order to support
! direct indexing into this map with a zero-based {\tt localDe} variable.
! \item[{[deToTileMap]}]
! Map each DE uniquely to a tile. Must enter allocated with
! {\tt shape(deToTileMap) == (/deCount/)}. It is recommended to
! use a lower bound of 0 for {\tt deToTileMap}, in order to support
! direct indexing into this map with a zero-based {\tt de} variable.
! \item[{[indexCountPDe]}]
! Number of indices for each dimension per DE. Must enter
! allocated with {\tt shape(indexCountPDe) == (/dimCount, deCount/)}.
! \item[{[collocation]}]
! Collocation identifier for each dimension. Must enter
! allocated with {\tt shape(collocation) == (/dimCount/)}.
! \item[{[regDecompFlag]}]
! Decomposition scheme. A return value of {\tt .true.} indicates
! a regular decomposition, i.e. the decomposition is based on a
! logically rectangular scheme with specific number of DEs along
! each dimension. A return value of {\tt .false.} indicates that the
! decomposition was {\em not} generated from a regular decomposition
! description, e.g. a {\tt deBlockList} was used instead.
! \item[{[indexTK]}]
! Typekind used by the global sequence indexing. See section
! \ref{const:typekind} for a list of typekind options. Only the integer
! types are supported for sequence indices.
! \item[{[indexflag]}]
! Return the indexing option used by the {\tt distgrid} object. See section
! \ref{const:indexflag} for a complete list of options.
! \item[{[connectionCount]}]
! Number of explicitly defined connections in {\tt distgrid}.
! \item[{[connectionList]}]
! List of explicitly defined connections in {\tt distgrid}. Must enter
! allocated with {\tt shape(connectionList) == (/connectionCount/)}.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{sloppypar}
! \end{description}
!
!EOP
!------------------------------------------------------------------------------
integer :: localrc ! local return code
integer :: i ! helper variable
integer :: dimCountAux ! helper variable
type(ESMF_InterArray) :: minIndexPTileAux ! helper variable
type(ESMF_InterArray) :: maxIndexPTileAux ! helper variable
type(ESMF_InterArray) :: elementCountPTileAux ! helper variable
type(ESMF_InterArray) :: elementCountPTileI8Aux ! helper variable
type(ESMF_InterArray) :: minIndexPDeAux ! helper variable
type(ESMF_InterArray) :: maxIndexPDeAux ! helper variable
type(ESMF_InterArray) :: elementCountPDeAux ! helper variable
type(ESMF_InterArray) :: elementCountPDeI8Aux ! helper variable
type(ESMF_InterArray) :: localDeToDeMapAux ! helper variable
type(ESMF_InterArray) :: deToTileMapAux ! helper variable
type(ESMF_InterArray) :: indexCountPDeAux ! helper variable
type(ESMF_InterArray) :: collocationAux ! helper variable
type(ESMF_Logical) :: regDecompFlagAux ! helper variable
type(ESMF_InterArray) :: connectionListAux ! helper variable
integer, pointer :: farray2D(:,:) ! 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(ESMF_DistGridGetInit, distgrid, rc)
! Deal with (optional) array arguments
minIndexPTileAux = &
ESMF_InterArrayCreate(farray2D=minIndexPTile, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
maxIndexPTileAux = &
ESMF_InterArrayCreate(farray2D=maxIndexPTile, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
elementCountPTileAux = ESMF_InterArrayCreate(elementCountPTile, &
rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
elementCountPTileI8Aux = &
ESMF_InterArrayCreate(farray1DI8=elementCountPTileI8, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
minIndexPDeAux = &
ESMF_InterArrayCreate(farray2D=minIndexPDe, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
maxIndexPDeAux = &
ESMF_InterArrayCreate(farray2D=maxIndexPDe, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
elementCountPDeAux = ESMF_InterArrayCreate(elementCountPDe, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
elementCountPDeI8Aux = &
ESMF_InterArrayCreate(farray1DI8=elementCountPDeI8, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
localDeToDeMapAux = ESMF_InterArrayCreate(localDeToDeMap, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
deToTileMapAux = ESMF_InterArrayCreate(deToTileMap, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
indexCountPDeAux = ESMF_InterArrayCreate(farray2D=indexCountPDe, &
rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
collocationAux = ESMF_InterArrayCreate(collocation, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
connectionListAux = ESMF_InterArrayCreateDGConn(connectionList, &
initFlag=.false., 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_DistGridGet(distgrid, dimCountAux, tileCount, deCount, &
localDeCount, minIndexPTileAux, maxIndexPTileAux, elementCountPTileAux, &
elementCountPTileI8Aux, minIndexPDeAux, maxIndexPDeAux, &
elementCountPDeAux, elementCountPDeI8Aux, localDeToDeMapAux, &
deToTileMapAux, indexCountPDeAux, collocationAux, regDecompFlagAux, &
connectionCount, connectionListAux, indexTK, indexFlag, delayout, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
if (present (regDecompFlag)) &
regDecompFlag = regDecompFlagAux
! Set init code for deep C++ objects
if (present(delayout)) then
call ESMF_DELayoutSetInitCreated(delayout, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
endif
! copy connectionList data
if (present(connectionList)) then
! access the array inside of connectionListAux
call ESMF_InterArrayGet(connectionListAux, farray2D=farray2D, &
rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! construct the DistGridConnections
do i=1, size(connectionList)
call ESMF_DistGridConnectionSetIntl(connectionList(i), &
farray=farray2D(1:2*dimCountAux+2, i), rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
enddo
endif
! copy dimCount
if (present(dimCount)) then
dimCount = dimCountAux
endif
! garbage collection
call ESMF_InterArrayDestroy(minIndexPTileAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(maxIndexPTileAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(elementCountPTileAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(elementCountPTileI8Aux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(minIndexPDeAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(maxIndexPDeAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(elementCountPDeAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(elementCountPDeI8Aux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(localDeToDeMapAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(deToTileMapAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(indexCountPDeAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(collocationAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(connectionListAux, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_DistGridGetDefault