ESMF_GeomCreateMesh Function

private function ESMF_GeomCreateMesh(mesh, meshLoc, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Mesh), intent(in) :: mesh
type(ESMF_MeshLoc), intent(in), optional :: meshLoc
integer, intent(out), optional :: rc

Return Value type(ESMF_Geom)


Source Code

      function ESMF_GeomCreateMesh(mesh, meshLoc, rc)
!
! !RETURN VALUE:
      type(ESMF_Geom) :: ESMF_GeomCreateMesh
!
! !ARGUMENTS:
       type(ESMF_Mesh),       intent(in)              :: mesh
       type(ESMF_MeshLoc),    intent(in),  optional   :: meshLoc
       integer,               intent(out), optional   :: rc
!
! !DESCRIPTION:
! Create an {\tt ESMF\_Geom} object from an {\tt ESMF\_Mesh} object.
!
! The arguments are:
! \begin{description}
! \item[mesh]
!      {\tt ESMF\_Mesh} object from which to create the Geom.
! \item [{[meshloc]}]
!       \begin{sloppypar}
!       The part of the Mesh on which to build the Field. For valid
!       predefined values see Section~\ref{const:meshloc}.
!       If not set, defaults to {\tt ESMF\_MESHLOC\_NODE}.
!       \end{sloppypar}
! \item[{[rc]}]
!      Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
    type(ESMF_GeomClass),pointer :: gbcp
    integer                          :: localrc ! local error status
    type(ESMF_MeshLoc)               :: localMeshLoc
    type(ESMF_DistGrid)              :: distgrid
    logical                          :: isPresent
    type(ESMF_Pointer)               :: dgThis

    ! Initialize return code; assume failure until success is certain
    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! Check init status of arguments
    ESMF_INIT_CHECK_DEEP_SHORT(ESMF_MeshGetInit, mesh, rc)

    ! initialize pointers
    nullify(gbcp)
    nullify( ESMF_GeomCreateMesh%gbcp)

    ! allocate Geom type
    allocate(gbcp, stat=localrc)
    if (ESMF_LogFoundAllocError(localrc, msg="Allocating Geom type object", &
                                     ESMF_CONTEXT, rcToReturn=rc)) return

    ! Set default
    if (present(meshLoc)) then
       localMeshLoc=meshLoc
    else
       localMeshLoc=ESMF_MESHLOC_NODE
    endif


    ! TODO: properly handle the indexflag information for Mesh
    ! Set values in Geom
    gbcp%type = ESMF_GEOMTYPE_MESH
    gbcp%mesh = mesh
    gbcp%meshloc = localMeshLoc

    ! Set Geom Type into Geom
     ESMF_GeomCreateMesh%gbcp=>gbcp

    ! Set init status
    ESMF_INIT_SET_CREATED(ESMF_GeomCreateMesh)

    ! Return successfully
    if (present(rc)) rc = ESMF_SUCCESS

    end function ESMF_GeomCreateMesh