CoordinateAxis.F90 Source File


This file depends on

sourcefile~~coordinateaxis.f90~~EfferentGraph sourcefile~coordinateaxis.f90 CoordinateAxis.F90 sourcefile~mapl_range.f90 MAPL_Range.F90 sourcefile~coordinateaxis.f90->sourcefile~mapl_range.f90 sourcefile~pfio.f90 pFIO.F90 sourcefile~coordinateaxis.f90->sourcefile~pfio.f90

Files dependent on this one

sourcefile~~coordinateaxis.f90~~AfferentGraph sourcefile~coordinateaxis.f90 CoordinateAxis.F90 sourcefile~cubedspheregeomspec_smod.f90 CubedSphereGeomSpec_smod.F90 sourcefile~cubedspheregeomspec_smod.f90->sourcefile~coordinateaxis.f90 sourcefile~equal_to.f90 equal_to.F90 sourcefile~equal_to.f90->sourcefile~coordinateaxis.f90 sourcefile~equal_to.f90~2 equal_to.F90 sourcefile~equal_to.f90~2->sourcefile~coordinateaxis.f90 sourcefile~get_centers.f90 get_centers.F90 sourcefile~get_centers.f90->sourcefile~coordinateaxis.f90 sourcefile~get_coordinates_dim.f90 get_coordinates_dim.F90 sourcefile~get_coordinates_dim.f90->sourcefile~coordinateaxis.f90 sourcefile~get_corners.f90 get_corners.F90 sourcefile~get_corners.f90->sourcefile~coordinateaxis.f90 sourcefile~get_dim_name.f90 get_dim_name.F90 sourcefile~get_dim_name.f90->sourcefile~coordinateaxis.f90 sourcefile~get_extent.f90 get_extent.F90 sourcefile~get_extent.f90->sourcefile~coordinateaxis.f90 sourcefile~is_periodic.f90 is_periodic.F90 sourcefile~is_periodic.f90->sourcefile~coordinateaxis.f90 sourcefile~lataxis.f90 LatAxis.F90 sourcefile~lataxis.f90->sourcefile~coordinateaxis.f90 sourcefile~lonaxis.f90 LonAxis.F90 sourcefile~lonaxis.f90->sourcefile~coordinateaxis.f90 sourcefile~make_decomposition.f90 make_decomposition.F90 sourcefile~make_decomposition.f90->sourcefile~coordinateaxis.f90 sourcefile~make_distribution.f90 make_distribution.F90 sourcefile~make_distribution.f90->sourcefile~coordinateaxis.f90 sourcefile~make_latlongeomspec_from_hconfig.f90 make_LatLonGeomSpec_from_hconfig.F90 sourcefile~make_latlongeomspec_from_hconfig.f90->sourcefile~coordinateaxis.f90 sourcefile~make_latlongeomspec_from_metadata.f90 make_LatLonGeomSpec_from_metadata.F90 sourcefile~make_latlongeomspec_from_metadata.f90->sourcefile~coordinateaxis.f90 sourcefile~new_coordinateaxis.f90 new_CoordinateAxis.F90 sourcefile~new_coordinateaxis.f90->sourcefile~coordinateaxis.f90 sourcefile~not_equal_to.f90 not_equal_to.F90 sourcefile~not_equal_to.f90->sourcefile~coordinateaxis.f90 sourcefile~supports_hconfig.f90~2 supports_hconfig.F90 sourcefile~supports_hconfig.f90~2->sourcefile~coordinateaxis.f90 sourcefile~supports_metadata.f90~2 supports_metadata.F90 sourcefile~supports_metadata.f90~2->sourcefile~coordinateaxis.f90 sourcefile~test_coordinateaxis.pf Test_CoordinateAxis.pf sourcefile~test_coordinateaxis.pf->sourcefile~coordinateaxis.f90 sourcefile~test_lonaxis.pf Test_LonAxis.pf sourcefile~test_lonaxis.pf->sourcefile~coordinateaxis.f90

Source Code

module mapl3g_CoordinateAxis
   use mapl_RangeMod
   use esmf, only: ESMF_KIND_R8
   use pfio
   implicit none
   private

   public :: CoordinateAxis
   public :: operator(==)
   public :: operator(/=)

   public :: get_coordinates
   public :: get_dim_name
   public :: AxisRanges

   integer, parameter :: R8 = ESMF_KIND_R8

   type :: AxisRanges
      real(kind=R8) :: center_min
      real(kind=R8) :: center_max
      real(kind=R8) :: corner_min
      real(kind=R8) :: corner_max
   end type AxisRanges

   type :: CoordinateAxis
      private
      real(kind=R8), allocatable :: centers(:)
      real(kind=R8), allocatable :: corners(:)
   contains
      procedure :: get_extent
      procedure :: get_centers
      procedure :: get_corners
      procedure :: is_periodic
   end type CoordinateAxis

   interface CoordinateAxis
      procedure new_CoordinateAxis
   end interface CoordinateAxis

   interface operator(==)
      module procedure equal_to
   end interface operator(==)

   interface operator(/=)
      module procedure not_equal_to
   end interface operator(/=)

   interface get_coordinates
      procedure get_coordinates_dim
   end interface get_coordinates

   ! Submodule
   interface

      pure module function new_CoordinateAxis(centers, corners) result(axis)
         type(CoordinateAxis) :: axis
         real(kind=R8), intent(in) :: centers(:)
         real(kind=R8), intent(in) :: corners(:)
      end function new_CoordinateAxis

      elemental logical module function equal_to(a, b)
         type(CoordinateAxis), intent(in) :: a, b
      end function equal_to

      elemental logical module function not_equal_to(a, b)
         type(CoordinateAxis), intent(in) :: a, b
      end function not_equal_to

      ! Accessors
      !----------
      ! Note that size(this%corners) might be one larger for non-periodic
      pure module function get_extent(this) result(extent)
         class(CoordinateAxis), intent(in) :: this
         integer :: extent
      end function get_extent

      pure module function get_centers(this) result(centers)
         real(kind=R8), allocatable :: centers(:)
         class(CoordinateAxis), intent(in) :: this
      end function get_centers

      pure module function get_corners(this) result(corners)
         real(kind=R8), allocatable :: corners(:)
         class(CoordinateAxis), intent(in) :: this
      end function get_corners

      pure logical module function is_periodic(this)
         class(CoordinateAxis), intent(in) :: this
      end function is_periodic

      module function get_dim_name(file_metadata, units, rc) result(dim_name)
         character(:), allocatable :: dim_name
         type(FileMetadata), target, intent(in) :: file_metadata
         character(*), intent(in) :: units
         integer, optional, intent(out) :: rc
      end function get_dim_name

      module function get_coordinates_dim(file_metadata, dim_name, rc) result(coordinates)
         use pfio, only: FileMetadata
         real(kind=R8), dimension(:), allocatable :: coordinates
         type(FileMetadata), intent(in) :: file_metadata
         character(len=*), intent(in) :: dim_name
         integer, optional, intent(out) :: rc
      end function get_coordinates_dim


   end interface

end module mapl3g_CoordinateAxis