ESMF_GeomCreateLocStream Function

private function ESMF_GeomCreateLocStream(locstream, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_LocStream), intent(in) :: locstream
integer, intent(out), optional :: rc

Return Value type(ESMF_Geom)


Source Code

      function ESMF_GeomCreateLocStream(locstream, rc)
!
! !RETURN VALUE:
      type(ESMF_Geom) :: ESMF_GeomCreateLocStream
!
! !ARGUMENTS:
       type(ESMF_LocStream),  intent(in)              :: locstream
       integer,               intent(out),  optional  :: rc
!
! !DESCRIPTION:
! Create an {\tt ESMF\_Geom} object from an {\tt ESMF\_LocStream} object.
!
! The arguments are:
! \begin{description}
! \item[locstream]
!      {\tt ESMF\_LocStream} object from which to create the Geom.
! \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

    ! 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_LocStreamGetInit, locstream, rc)

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

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

    ! Set values in Geom
    gbcp%type = ESMF_GEOMTYPE_LOCSTREAM
    gbcp%locstream = locstream

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

    ! Set init status
    ESMF_INIT_SET_CREATED(ESMF_GeomCreateLocStream)

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

    end function ESMF_GeomCreateLocStream