VerticalGrid.F90 Source File


This file depends on

sourcefile~~verticalgrid.f90~~EfferentGraph sourcefile~verticalgrid.f90 VerticalGrid.F90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~verticalgrid.f90->sourcefile~errorhandling.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90

Files dependent on this one

sourcefile~~verticalgrid.f90~~AfferentGraph sourcefile~verticalgrid.f90 VerticalGrid.F90 sourcefile~basicverticalgrid.f90 BasicVerticalGrid.F90 sourcefile~basicverticalgrid.f90->sourcefile~verticalgrid.f90 sourcefile~bracketspec.f90 BracketSpec.F90 sourcefile~bracketspec.f90->sourcefile~verticalgrid.f90 sourcefile~fieldspec.f90 FieldSpec.F90 sourcefile~fieldspec.f90->sourcefile~verticalgrid.f90 sourcefile~fixedlevelsverticalgrid.f90 FixedLevelsVerticalGrid.F90 sourcefile~fixedlevelsverticalgrid.f90->sourcefile~verticalgrid.f90 sourcefile~generic3g.f90 Generic3g.F90 sourcefile~generic3g.f90->sourcefile~verticalgrid.f90 sourcefile~geometryspec.f90 GeometrySpec.F90 sourcefile~geometryspec.f90->sourcefile~verticalgrid.f90 sourcefile~invalidspec.f90 InvalidSpec.F90 sourcefile~invalidspec.f90->sourcefile~verticalgrid.f90 sourcefile~mapl_generic.f90 MAPL_Generic.F90 sourcefile~mapl_generic.f90->sourcefile~verticalgrid.f90 sourcefile~mirrorverticalgrid.f90 MirrorVerticalGrid.F90 sourcefile~mirrorverticalgrid.f90->sourcefile~verticalgrid.f90 sourcefile~mockitemspec.f90 MockItemSpec.F90 sourcefile~mockitemspec.f90->sourcefile~verticalgrid.f90 sourcefile~modelverticalgrid.f90 ModelVerticalGrid.F90 sourcefile~modelverticalgrid.f90->sourcefile~verticalgrid.f90 sourcefile~outermetacomponent.f90 OuterMetaComponent.F90 sourcefile~outermetacomponent.f90->sourcefile~verticalgrid.f90 sourcefile~parse_geometry_spec.f90 parse_geometry_spec.F90 sourcefile~parse_geometry_spec.f90->sourcefile~verticalgrid.f90 sourcefile~servicespec.f90 ServiceSpec.F90 sourcefile~servicespec.f90->sourcefile~verticalgrid.f90 sourcefile~stateregistry.f90 StateRegistry.F90 sourcefile~stateregistry.f90->sourcefile~verticalgrid.f90 sourcefile~statespec.f90 StateSpec.F90 sourcefile~statespec.f90->sourcefile~verticalgrid.f90 sourcefile~test_bracketspec.pf Test_BracketSpec.pf sourcefile~test_bracketspec.pf->sourcefile~verticalgrid.f90 sourcefile~variablespec.f90 VariableSpec.F90 sourcefile~variablespec.f90->sourcefile~verticalgrid.f90 sourcefile~wildcardspec.f90 WildcardSpec.F90 sourcefile~wildcardspec.f90->sourcefile~verticalgrid.f90

Source Code

#include "MAPL_Generic.h"

module mapl3g_VerticalGrid
   use mapl_ErrorHandling
   implicit none
   private

   public :: VerticalGrid

   type, abstract :: VerticalGrid
      private
      integer :: id = -1
      character(:), allocatable :: units
   contains
      procedure(I_get_num_levels), deferred :: get_num_levels
      procedure(I_get_coordinate_field), deferred :: get_coordinate_field
      procedure(I_can_connect_to), deferred :: can_connect_to
      procedure(I_write_formatted), deferred :: write_formatted
      generic :: write(formatted) => write_formatted

      procedure :: set_id
      procedure :: get_id
      procedure :: same_id
      procedure :: set_units
      procedure :: get_units
      procedure :: make_info
   end type VerticalGrid

   integer :: global_id = 0

   abstract interface

      integer function I_get_num_levels(this) result(num_levels)
         import VerticalGrid
         class(VerticalGrid), intent(in) :: this
      end function I_get_num_levels

      subroutine I_get_coordinate_field(this, field, coupler, standard_name, geom, typekind, units, vertical_dim_spec, rc)
         use mapl3g_GriddedComponentDriver
         use mapl3g_VerticalDimSpec
         use esmf, only: ESMF_Geom, ESMF_TypeKind_Flag, ESMF_Field
         import VerticalGrid

         class(VerticalGrid), intent(in) :: this
         type(ESMF_Field), intent(out) :: field
         type(GriddedComponentDriver), pointer, intent(out) :: coupler
         character(*), intent(in) :: standard_name
         type(ESMF_Geom), intent(in) :: geom
         type(ESMF_TypeKind_Flag), intent(in) :: typekind
         character(*), intent(in) :: units
         type(VerticalDimSpec), intent(in) :: vertical_dim_spec
         integer, optional, intent(out) :: rc
      end subroutine I_get_coordinate_field

      logical function I_can_connect_to(this, src, rc) result(can_connect_to)
         import VerticalGrid
         class(VerticalGrid), intent(in) :: this
         class(VerticalGrid), intent(in) :: src
         integer, optional, intent(out) :: rc
      end function I_can_connect_to

      subroutine I_write_formatted(this, unit, iotype, v_list, iostat, iomsg)
         import VerticalGrid
         class(VerticalGrid), intent(in) :: this
         integer, intent(in) :: unit
         character(*), intent(in) :: iotype
         integer, intent(in) :: v_list(:)
         integer, intent(out) :: iostat
         character(*), intent(inout) :: iomsg
      end subroutine I_write_formatted

   end interface

contains

   subroutine set_id(this)
      class(VerticalGrid), intent(inout) :: this
      global_id = global_id + 1
      this%id = global_id
   end subroutine set_id

   function get_id(this) result(id)
      class(VerticalGrid), intent(in) :: this
      integer :: id
      id = this%id
   end function get_id

   logical function same_id(this, other)
      class(VerticalGrid), intent(in) :: this
      class(VerticalGrid), intent(in) :: other
      same_id = (this%id == other%id)
   end function same_id

   subroutine set_units(this, units)
      class(VerticalGrid), intent(inout) :: this
      character(*), intent(in) :: units
      this%units = units
   end subroutine set_units

   function get_units(this) result(units)
      character(:), allocatable :: units
      class(VerticalGrid), intent(in) :: this
      units = this%units
   end function get_units

   function make_info(this, rc) result(info)
      use esmf
      type(ESMF_Info) :: info
      class(VerticalGrid), intent(in) :: this
      integer, optional, intent(out) :: rc

      integer :: status

      info =ESMF_InfoCreate(_RC)
      call ESMF_InfoSet(info, "num_levels", this%get_num_levels(), _RC)

      _RETURN(_SUCCESS)
   end function make_info

end module mapl3g_VerticalGrid