subroutine MAPL_LocStreamGet(LocStream, NT_LOCAL, nt_global, TILETYPE, TILEKIND, &
TILELONS, TILELATS, TILEAREA, &
TILEGRID, &
GRIDIM, GRIDJM, GRIDNAMES, &
ATTACHEDGRID, LOCAL_ID, local_i, local_j,RC)
type(MAPL_LocStream), intent(IN ) :: LocStream
integer, optional, intent( OUT) :: NT_LOCAL
integer, optional, pointer :: TILETYPE(:)
integer, optional, pointer :: TILEKIND(:)
real , optional, pointer :: TILELONS(:)
real , optional, pointer :: TILELATS(:)
real , optional, pointer :: TILEAREA(:)
! integer, optional, pointer :: TILEI(:)
! integer, optional, pointer :: TILEJ(:)
integer, optional, pointer :: GRIDIM(:)
integer, optional, pointer :: GRIDJM(:)
integer, optional, pointer :: LOCAL_ID(:)
integer, optional, intent(out) :: nt_global
character(len=*), optional, pointer :: GRIDNAMES(:)
type(ESMF_Grid), optional, intent( OUT) :: TILEGRID
type(ESMF_Grid), optional, intent( OUT) :: ATTACHEDGRID
integer, optional, pointer, intent( OUT) :: local_i(:)
integer, optional, pointer, intent( OUT) :: local_j(:)
integer, optional, intent( OUT) :: RC
! MAT These GFORTRAN workarounds are needed because without them
! runs of GEOS do not layout regress. That is a 4x24 run is not
! zero-diff with a 3x18 run. If you decide to remove these, test
! to make sure this works.
#ifdef __GFORTRAN__
integer :: i
integer, pointer :: tmp_iptr(:) => null()
real, pointer :: tmp_rptr(:) => null()
character(len=MAPL_TileNameLength), pointer :: tmp_strptr(:) => null()
#endif
! Local variables
if (present(NT_LOCAL)) then
NT_LOCAL = locstream%Ptr%NT_LOCAL
end if
if (present(nt_global)) then
nt_global = locstream%ptr%nt_global
end if
if (present(tiletype)) then
tiletype => locstream%Ptr%Local_GeoLocation(:)%t
end if
if (present(tilekind)) then
PRINT *, 'IN LocStreamGet TILEKIND NO LONGER VALID ARGUMENT'
_FAIL('needs informative message')
! tilekind => locstream%Ptr%Local_GeoLocation(:)%u
end if
! MAT These GFORTRAN workarounds are needed because without them
! runs of GEOS do not layout regress. That is a 4x24 run is not
! zero-diff with a 3x18 run. If you decide to remove these, test
! to make sure this works.
if (present(tilelons)) then
#ifdef __GFORTRAN__
allocate(tmp_rptr(lbound(locstream%Ptr%Local_GeoLocation,1):ubound(locstream%Ptr%Local_GeoLocation,1)))
do i = lbound(locstream%Ptr%Local_GeoLocation,1), ubound(locstream%Ptr%Local_GeoLocation,1)
tmp_rptr(i) = locstream%Ptr%Local_GeoLocation(i)%x
enddo
tilelons => tmp_rptr
#else
tilelons => locstream%Ptr%Local_GeoLocation(:)%x
#endif
end if
if (present(tilelats)) then
#ifdef __GFORTRAN__
allocate(tmp_rptr(lbound(locstream%Ptr%Local_GeoLocation,1):ubound(locstream%Ptr%Local_GeoLocation,1)))
do i = lbound(locstream%Ptr%Local_GeoLocation,1), ubound(locstream%Ptr%Local_GeoLocation,1)
tmp_rptr(i) = locstream%Ptr%Local_GeoLocation(i)%y
enddo
tilelats => tmp_rptr
#else
tilelats => locstream%Ptr%Local_GeoLocation(:)%y
#endif
end if
if (present(tilearea)) then
if (locstream%Ptr%IsTileAreaValid) then
tilearea => locstream%Ptr%Local_GeoLocation(:)%a
else
tilearea => null()
end if
end if
if (present(gridim)) then
gridim => locstream%Ptr%tiling(:)%im
end if
if (present(gridjm)) then
gridjm => locstream%Ptr%tiling(:)%jm
end if
if (present(local_id)) then
local_id => locstream%Ptr%local_id
end if
if (present(gridnames)) then
gridnames => locstream%Ptr%tiling(:)%name
end if
if (present(attachedgrid)) then
attachedgrid = locstream%Ptr%grid
end if
if (present(tilegrid)) then
tilegrid = locstream%Ptr%TILEGRID
end if
if (present(local_i)) then
local_i => locstream%Ptr%LOCAL_INDEXLOCATION(:)%i
end if
if (present(local_j)) then
local_j => locstream%Ptr%LOCAL_INDEXLOCATION(:)%j
end if
_RETURN(ESMF_SUCCESS)
end subroutine MAPL_LocStreamGet