subroutine ESMF_GeomValidate(geom, rc)
!
! !ARGUMENTS:
type(ESMF_Geom), intent(in) :: geom
integer, intent(out), optional :: rc
!
!
! !DESCRIPTION:
! Validates that the {\tt Geom} is internally consistent.
!
! The arguments are:
! \begin{description}
! \item[geom]
! Specified {\tt ESMF\_Geom} object.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI
!------------------------------------------------------------------------------
integer :: localrc
type(ESMF_GeomClass),pointer :: gbcp
! Initialize return code; assume failure until success is certain
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Check init status of arguments
ESMF_INIT_CHECK_DEEP_SHORT(ESMF_GeomGetInit, geom, rc)
! Get GeomClass
gbcp=>geom%gbcp
! Get info depending on type
select case(gbcp%type%type)
case (ESMF_GEOMTYPE_GRID%type) ! Grid
call ESMF_GridValidate(grid=gbcp%grid, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
case (ESMF_GEOMTYPE_MESH%type) ! Mesh
!call ESMF_MeshValidate(mesh=gbcp%mesh, rc=localrc)
! if (ESMF_LogFoundError(localrc, &
! ESMF_ERR_PASSTHRU, &
! ESMF_CONTEXT, rcToReturn=rc)) return
case (ESMF_GEOMTYPE_LOCSTREAM%type) ! LocStream
call ESMF_LocStreamValidate(locstream=gbcp%locstream, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
case (ESMF_GEOMTYPE_XGRID%type) ! XGrid
call ESMF_XGridValidate(xgrid=gbcp%xgrid, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
case default
if (ESMF_LogFoundError(ESMF_RC_ARG_VALUE, &
msg=" Bad type value", &
ESMF_CONTEXT, rcToReturn=rc)) return
end select
! Set return value
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_GeomValidate