ESMF_MeshCreateFromGrid Function

private function ESMF_MeshCreateFromGrid(grid, name, rc)

Arguments

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

Return Value type(ESMF_Mesh)


Calls

proc~~esmf_meshcreatefromgrid~~CallsGraph proc~esmf_meshcreatefromgrid ESMF_MeshCreateFromGrid c_esmc_meshcreateelemdistgrid c_esmc_meshcreateelemdistgrid proc~esmf_meshcreatefromgrid->c_esmc_meshcreateelemdistgrid c_esmc_meshcreatefromgrid c_esmc_meshcreatefromgrid proc~esmf_meshcreatefromgrid->c_esmc_meshcreatefromgrid c_esmc_meshcreatenodedistgrid c_esmc_meshcreatenodedistgrid proc~esmf_meshcreatefromgrid->c_esmc_meshcreatenodedistgrid c_esmc_meshsetstatus c_esmc_meshsetstatus proc~esmf_meshcreatefromgrid->c_esmc_meshsetstatus proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_meshcreatefromgrid->proc~esmf_logfounderror esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_logopenfile->proc~esmf_utiliounitget

Called by

proc~~esmf_meshcreatefromgrid~~CalledByGraph proc~esmf_meshcreatefromgrid ESMF_MeshCreateFromGrid interface~esmf_meshcreate ESMF_MeshCreate interface~esmf_meshcreate->proc~esmf_meshcreatefromgrid

Source Code

    function ESMF_MeshCreateFromGrid(grid, name, rc)
!
!
! !RETURN VALUE:
    type(ESMF_Mesh)         :: ESMF_MeshCreateFromGrid
! !ARGUMENTS:
    type(ESMF_Grid),        intent(in)            :: grid
    character(len=*),       intent(in),  optional :: name
    integer,                intent(out), optional :: rc

!
! !DESCRIPTION:
!   Create an ESMF Mesh from an ESMF Grid. This method creates the elements of
!  the Mesh from the cells of the Grid, and the nodes of the Mesh from the corners of
!  the Grid. Corresponding locations in the Grid and new Mesh will have the same
!  coordinates, sequence indices, masking, and area information.
!
!   This method currently only works for 2D Grids. In addition, this method requires
!   the input Grid to have coordinates in the corner stagger location.
!
!   \begin{description}
!   \item [grid]
!         The ESMF Grid from which to create the Mesh.
!   \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
    integer :: numNode, numElem

    ! Create C side Mesh
    ! Optional name argument requires separate calls into C++
    if (present(name)) then
      call C_ESMC_MeshCreateFromGrid(ESMF_MeshCreateFromGrid%this, &
                                     grid, name, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return
    else
      call C_ESMC_MeshCreateFromGrid(ESMF_MeshCreateFromGrid%this, &
                                     grid, "", localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return
    endif

    ! these should be set inside MeshCap
    ! Create nodal distgrid
    call C_ESMC_MeshCreateNodeDistGrid(ESMF_MeshCreateFromGrid, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
         ESMF_CONTEXT, rcToReturn=rc)) return

    ! Create element distgrid
    call C_ESMC_MeshCreateElemDistGrid(ESMF_MeshCreateFromGrid, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
         ESMF_CONTEXT, rcToReturn=rc)) return

    ! Set Status
    call C_ESMC_MeshSetStatus(ESMF_MeshCreateFromGrid, ESMF_MESHSTATUS_COMPLETE)

    ! Set init status of mesh
    ESMF_INIT_SET_CREATED(ESMF_MeshCreateFromGrid)

    ! Return success
    if (present(rc)) rc=ESMF_SUCCESS
    return
end function ESMF_MeshCreateFromGrid