ESMF_MeshEmptyCreate Function

public function ESMF_MeshEmptyCreate(nodalDistgrid, elementdistgrid, name, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_DistGrid), intent(in), optional :: nodalDistgrid
type(ESMF_DistGrid), intent(in), optional :: elementdistgrid
character(len=*), intent(in), optional :: name
integer, intent(out), optional :: rc

Return Value type(ESMF_Mesh)


Source Code

    function ESMF_MeshEmptyCreate(nodalDistgrid, elementDistgrid, name, rc)
!
!
! !RETURN VALUE:
    type(ESMF_Mesh)         :: ESMF_MeshEmptyCreate
! !ARGUMENTS:
    type(ESMF_DistGrid),      intent(in),  optional :: elementdistgrid
    type(ESMF_DistGrid),      intent(in),  optional :: nodalDistgrid
    character(len=*),         intent(in),  optional :: name
    integer,                  intent(out), optional :: rc

!
! !DESCRIPTION:
!   Create a Mesh to hold distribution information (i.e. Distgrids).
!   Such a mesh will have no coordinate or connectivity information stored.
!   Aside from holding distgrids the Mesh created by this call can't be used in other
!   ESMF functionality (e.g. it can't be used to create a Field or in regridding).
!
!   \begin{description}
!   \item [{[nodalDistgrid]}]
!         The nodal distgrid.
!   \item [{[elementDistgrid]}]
!         The elemental distgrid.
!   \item [{[name]}]
!         The name of the Mesh.
!   \item [{[rc]}]
!         Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOP
!------------------------------------------------------------------------------

    integer  :: localrc
    

    ! ensure that Base is okay to be queried
    call c_ESMC_MeshCreateEmpty(ESMF_MeshEmptyCreate, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! Mark that there isn't a C mesh underneath
    call C_ESMC_MeshSetIsFree(ESMF_MeshEmptyCreate)

    ! This is only a vehical for carrying distgrids, so it's not fully
    ! created yet. It should error out of most calls, except a specific set
    ! of MeshGet() queries.
    call C_ESMC_MeshSetStatus(ESMF_MeshEmptyCreate, ESMF_MESHSTATUS_EMPTY)

    if (present(nodalDistgrid)) then
      call C_ESMC_MeshSetNodeDistGrid(ESMF_MeshEmptyCreate, nodalDistgrid, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    endif
    
    if (present(elementdistgrid)) then
      call C_ESMC_MeshSetElemDistGrid(ESMF_MeshEmptyCreate, elementdistgrid, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    endif    

    ! Set the name in Base object
    if (present(name)) then
      call c_ESMC_SetName(ESMF_MeshEmptyCreate, "Mesh", name, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    endif

    ! mark as created
    ESMF_INIT_SET_CREATED(ESMF_MeshEmptyCreate)

    if (present(rc)) rc=ESMF_SUCCESS
    return
end function ESMF_MeshEmptyCreate