ESMF_XGridDistGridsOnline Subroutine

private subroutine ESMF_XGridDistGridsOnline(xgtype, mesh, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_XGridType), intent(inout) :: xgtype
type(ESMF_Mesh), intent(inout) :: mesh
integer, intent(out), optional :: rc

Calls

proc~~esmf_xgriddistgridsonline~~CallsGraph proc~esmf_xgriddistgridsonline ESMF_XGridDistGridsOnline interface~esmf_distgridcreate ESMF_DistGridCreate proc~esmf_xgriddistgridsonline->interface~esmf_distgridcreate proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_xgriddistgridsonline->proc~esmf_logfounderror proc~esmf_meshget ESMF_MeshGet proc~esmf_xgriddistgridsonline->proc~esmf_meshget proc~esmf_xgridgeombaseget ESMF_XGridGeomBaseGet proc~esmf_xgriddistgridsonline->proc~esmf_xgridgeombaseget

Called by

proc~~esmf_xgriddistgridsonline~~CalledByGraph proc~esmf_xgriddistgridsonline ESMF_XGridDistGridsOnline proc~esmf_xgridconstruct ESMF_XGridConstruct proc~esmf_xgridconstruct->proc~esmf_xgriddistgridsonline proc~esmf_xgridcreate ESMF_XGridCreate proc~esmf_xgridcreate->proc~esmf_xgridconstruct proc~esmf_xgridcreatefromsparsemat ESMF_XGridCreateFromSparseMat proc~esmf_xgridcreatefromsparsemat->proc~esmf_xgridconstruct

Source Code

subroutine ESMF_XGridDistGridsOnline(xgtype, mesh, rc)

!
! !ARGUMENTS:
    type(ESMF_XGridType), intent(inout) :: xgtype
    type(ESMF_Mesh),      intent(inout) :: mesh
    integer, intent(out), optional      :: rc

!
! !DESCRIPTION:
!      Create the distgrids for the {ESMF\_XGridType} object
!
!     The arguments are:
!     \begin{description}
!     \item [xgtype]
!           the {ESMF\_XGridType} object.
!     \item [{[mesh]}]
!           the {ESMF\_Mesh} object.
!     \item [{[rc]}]
!           Return code; equals {\tt ESMF\_SUCCESS} only if successful.
!     \end{description}
!
!EOPI

  integer                                :: localrc, i
  type(ESMF_DistGrid)                    :: distgrid

  ! Initialize
  localrc = ESMF_RC_NOT_IMPL

  ! Initialize return code   
  if(present(rc)) rc = ESMF_RC_NOT_IMPL

  if(xgtype%storeOverlay) then
    call ESMF_MeshGet(mesh, elementDistgrid=xgtype%distgridM, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
        ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
  else
    call ESMF_MeshGet(mesh, elementDistgrid=distgrid, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
        ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    xgtype%distgridM = ESMF_DistGridCreate(distgrid, indexflag=ESMF_INDEX_GLOBAL, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
        ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
  endif
  allocate(xgtype%distgridA(size(xgtype%sideA)))
  allocate(xgtype%distgridB(size(xgtype%sideB)))
  do i = 1, size(xgtype%sideA)
    call ESMF_XGridGeomBaseGet(xgtype%sideA(i), distgrid=xgtype%distgridA(i), rc=localrc)
    if (ESMF_LogFoundError(localrc, &
        ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
  enddo
  do i = 1, size(xgtype%sideB)
    call ESMF_XGridGeomBaseGet(xgtype%sideB(i), distgrid=xgtype%distgridB(i), rc=localrc)
    if (ESMF_LogFoundError(localrc, &
        ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
  enddo

  if(present(rc)) rc = ESMF_SUCCESS

end subroutine ESMF_XGridDistGridsOnline