MAPL_GeomGetCoords.F90 Source File


This file depends on

sourcefile~~mapl_geomgetcoords.f90~~EfferentGraph sourcefile~mapl_geomgetcoords.f90 MAPL_GeomGetCoords.F90 sourcefile~base_base.f90 Base_Base.F90 sourcefile~mapl_geomgetcoords.f90->sourcefile~base_base.f90 sourcefile~vectorbasis.f90 VectorBasis.F90 sourcefile~mapl_geomgetcoords.f90->sourcefile~vectorbasis.f90 sourcefile~constants.f90 Constants.F90 sourcefile~base_base.f90->sourcefile~constants.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~base_base.f90->sourcefile~keywordenforcer.f90 sourcefile~mapl_range.f90 MAPL_Range.F90 sourcefile~base_base.f90->sourcefile~mapl_range.f90 sourcefile~maplgrid.f90 MaplGrid.F90 sourcefile~base_base.f90->sourcefile~maplgrid.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~vectorbasis.f90->sourcefile~errorhandling.f90 sourcefile~fieldblas.f90 FieldBLAS.F90 sourcefile~vectorbasis.f90->sourcefile~fieldblas.f90 sourcefile~fieldpointerutilities.f90 FieldPointerUtilities.F90 sourcefile~vectorbasis.f90->sourcefile~fieldpointerutilities.f90 sourcefile~internalconstants.f90 InternalConstants.F90 sourcefile~constants.f90->sourcefile~internalconstants.f90 sourcefile~mathconstants.f90 MathConstants.F90 sourcefile~constants.f90->sourcefile~mathconstants.f90 sourcefile~physicalconstants.f90 PhysicalConstants.F90 sourcefile~constants.f90->sourcefile~physicalconstants.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~fieldblas.f90->sourcefile~fieldpointerutilities.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~fieldblas.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~fieldpointerutilities.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~mapl_range.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~maplgrid.f90->sourcefile~constants.f90 sourcefile~maplgrid.f90->sourcefile~errorhandling.f90 sourcefile~maplgrid.f90->sourcefile~keywordenforcer.f90 sourcefile~mapl_sort.f90 MAPL_Sort.F90 sourcefile~maplgrid.f90->sourcefile~mapl_sort.f90 sourcefile~pflogger_stub.f90 pflogger_stub.F90 sourcefile~maplgrid.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_exceptionhandling.f90->sourcefile~errorhandling.f90 sourcefile~mapl_exceptionhandling.f90->sourcefile~mapl_throw.f90 sourcefile~mapl_sort.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~pfl_keywordenforcer.f90 PFL_KeywordEnforcer.F90 sourcefile~pflogger_stub.f90->sourcefile~pfl_keywordenforcer.f90 sourcefile~wraparray.f90 WrapArray.F90 sourcefile~pflogger_stub.f90->sourcefile~wraparray.f90 sourcefile~physicalconstants.f90->sourcefile~mathconstants.f90

Source Code

#include "MAPL_ErrLog.h"

submodule (mapl3g_VectorBasis) MAPL_GeomGetCoords_smod
   use mapl_base, only: MAPL_GridGetCorners
contains


   module subroutine MAPL_GeomGetCoords(geom, longitudes, latitudes, rc)
      type(ESMF_Geom), intent(in) :: geom
      real(kind=ESMF_KIND_R8), pointer :: longitudes(:)
      real(kind=ESMF_KIND_R8), pointer :: latitudes(:)
      integer, optional, intent(out) :: rc

      type(ESMF_GeomType_Flag) :: geomtype
      type(ESMF_Grid) :: grid
      type(ESMF_LocStream) :: locstream
      integer :: status

      call ESMF_GeomGet(geom, geomtype=geomtype, _RC)
      if (geomtype == ESMF_GEOMTYPE_GRID) then
         call ESMF_GeomGet(geom, grid=grid, _RC)
         call GridGetCoords(grid, longitudes, latitudes, _RC)
      else if (geomtype == ESMF_GEOMTYPE_LOCSTREAM) then
         call ESMF_GeomGet(geom, locstream=locstream, _RC)
         call get_locstream_coords(locstream, longitudes, latitudes, _RC)
      else if (any([geomtype==ESMF_GEOMTYPE_MESH, geomtype==ESMF_GEOMTYPE_XGRID])) then
         _FAIL("Unsupported geom type.")
      else
         _FAIL("Illeggal geom type.")
      end if
      _RETURN(ESMF_SUCCESS)

   contains

      subroutine get_locstream_coords(locstream, longitudes, latitudes, rc)
         type(ESMF_LocStream), intent(in) :: locstream
         real(kind=ESMF_KIND_R8), pointer :: longitudes(:)
         real(kind=ESMF_KIND_R8), pointer :: latitudes(:)
         integer, optional, intent(out) :: rc

         integer :: status

         call ESMF_LocStreamGetKey(locstream, keyName='ESMF:Lon', farray=longitudes, _RC)
         call ESMF_LocStreamGetKey(locstream, keyName='ESMF:Lat', farray=latitudes, _RC)

         _RETURN(ESMF_SUCCESS)
      end subroutine get_locstream_coords

   end subroutine MAPL_GeomGetCoords

end submodule MAPL_GeomGetCoords_smod