BasicVerticalGrid.F90 Source File


This file depends on

sourcefile~~basicverticalgrid.f90~~EfferentGraph sourcefile~basicverticalgrid.f90 BasicVerticalGrid.F90 sourcefile~componentdriver.f90 ComponentDriver.F90 sourcefile~basicverticalgrid.f90->sourcefile~componentdriver.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~basicverticalgrid.f90->sourcefile~errorhandling.f90 sourcefile~mirrorverticalgrid.f90 MirrorVerticalGrid.F90 sourcefile~basicverticalgrid.f90->sourcefile~mirrorverticalgrid.f90 sourcefile~verticaldimspec.f90 VerticalDimSpec.F90 sourcefile~basicverticalgrid.f90->sourcefile~verticaldimspec.f90 sourcefile~verticalgrid.f90 VerticalGrid.F90 sourcefile~basicverticalgrid.f90->sourcefile~verticalgrid.f90 sourcefile~componentdriver.f90->sourcefile~errorhandling.f90 sourcefile~maplshared.f90 MaplShared.F90 sourcefile~componentdriver.f90->sourcefile~maplshared.f90 sourcefile~multistate.f90 MultiState.F90 sourcefile~componentdriver.f90->sourcefile~multistate.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~mirrorverticalgrid.f90->sourcefile~componentdriver.f90 sourcefile~mirrorverticalgrid.f90->sourcefile~errorhandling.f90 sourcefile~mirrorverticalgrid.f90->sourcefile~verticaldimspec.f90 sourcefile~mirrorverticalgrid.f90->sourcefile~verticalgrid.f90 sourcefile~verticaldimspec.f90->sourcefile~errorhandling.f90 sourcefile~mapl_esmf_infokeys.f90 MAPL_ESMF_InfoKeys.F90 sourcefile~verticaldimspec.f90->sourcefile~mapl_esmf_infokeys.f90 sourcefile~verticalgrid.f90->sourcefile~errorhandling.f90 sourcefile~mapl_esmf_infokeys.f90->sourcefile~errorhandling.f90 sourcefile~maplshared.f90->sourcefile~errorhandling.f90 sourcefile~maplshared.f90->sourcefile~mapl_throw.f90 sourcefile~abstractcommsplitter.f90 AbstractCommSplitter.F90 sourcefile~maplshared.f90->sourcefile~abstractcommsplitter.f90 sourcefile~commgroupdescription.f90 CommGroupDescription.F90 sourcefile~maplshared.f90->sourcefile~commgroupdescription.f90 sourcefile~constants.f90 Constants.F90 sourcefile~maplshared.f90->sourcefile~constants.f90 sourcefile~downbit.f90 DownBit.F90 sourcefile~maplshared.f90->sourcefile~downbit.f90 sourcefile~dso_utilities.f90 DSO_Utilities.F90 sourcefile~maplshared.f90->sourcefile~dso_utilities.f90 sourcefile~filesystemutilities.f90 FileSystemUtilities.F90 sourcefile~maplshared.f90->sourcefile~filesystemutilities.f90 sourcefile~interp.f90 Interp.F90 sourcefile~maplshared.f90->sourcefile~interp.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~maplshared.f90->sourcefile~keywordenforcer.f90 sourcefile~mapl_dirpath.f90 MAPL_DirPath.F90 sourcefile~maplshared.f90->sourcefile~mapl_dirpath.f90 sourcefile~mapl_hash.f90 MAPL_Hash.F90 sourcefile~maplshared.f90->sourcefile~mapl_hash.f90 sourcefile~mapl_loadbalance.f90 MAPL_LoadBalance.F90 sourcefile~maplshared.f90->sourcefile~mapl_loadbalance.f90 sourcefile~mapl_minmax.f90 MAPL_MinMax.F90 sourcefile~maplshared.f90->sourcefile~mapl_minmax.f90 sourcefile~mapl_range.f90 MAPL_Range.F90 sourcefile~maplshared.f90->sourcefile~mapl_range.f90 sourcefile~mapl_sleep.f90 MAPL_Sleep.F90 sourcefile~maplshared.f90->sourcefile~mapl_sleep.f90 sourcefile~mapl_sort.f90 MAPL_Sort.F90 sourcefile~maplshared.f90->sourcefile~mapl_sort.f90 sourcefile~shmem.f90 Shmem.F90 sourcefile~maplshared.f90->sourcefile~shmem.f90 sourcefile~simplecommsplitter.f90 SimpleCommSplitter.F90 sourcefile~maplshared.f90->sourcefile~simplecommsplitter.f90 sourcefile~splitcommunicator.f90 SplitCommunicator.F90 sourcefile~maplshared.f90->sourcefile~splitcommunicator.f90 sourcefile~string.f90 String.F90 sourcefile~maplshared.f90->sourcefile~string.f90 sourcefile~multistate.f90->sourcefile~errorhandling.f90 sourcefile~esmf_utilities.f90 ESMF_Utilities.F90 sourcefile~multistate.f90->sourcefile~esmf_utilities.f90 sourcefile~multistate.f90->sourcefile~keywordenforcer.f90

Files dependent on this one

sourcefile~~basicverticalgrid.f90~~AfferentGraph sourcefile~basicverticalgrid.f90 BasicVerticalGrid.F90 sourcefile~historycollectiongridcomp.f90 HistoryCollectionGridComp.F90 sourcefile~historycollectiongridcomp.f90->sourcefile~basicverticalgrid.f90 sourcefile~parse_geometry_spec.f90 parse_geometry_spec.F90 sourcefile~parse_geometry_spec.f90->sourcefile~basicverticalgrid.f90 sourcefile~setservices.f90 SetServices.F90 sourcefile~setservices.f90->sourcefile~basicverticalgrid.f90 sourcefile~test_addfieldspec.pf Test_AddFieldSpec.pf sourcefile~test_addfieldspec.pf->sourcefile~basicverticalgrid.f90 sourcefile~test_bracketspec.pf Test_BracketSpec.pf sourcefile~test_bracketspec.pf->sourcefile~basicverticalgrid.f90 sourcefile~test_configurablegridcomp.pf Test_ConfigurableGridComp.pf sourcefile~test_configurablegridcomp.pf->sourcefile~basicverticalgrid.f90 sourcefile~test_fieldspec.pf Test_FieldSpec.pf sourcefile~test_fieldspec.pf->sourcefile~basicverticalgrid.f90 sourcefile~historygridcomp.f90 HistoryGridComp.F90 sourcefile~historygridcomp.f90->sourcefile~historycollectiongridcomp.f90

Source Code

#include "MAPL_Generic.h"

module mapl3g_BasicVerticalGrid

   use mapl_ErrorHandling
   use mapl3g_VerticalGrid
   use mapl3g_MirrorVerticalGrid
   use mapl3g_ComponentDriver
   use mapl3g_VerticalDimSpec
   use esmf, only: ESMF_TypeKind_Flag
   use esmf, only: ESMF_Field
   use esmf, only: ESMF_Geom

   implicit none
   private

   public :: BasicVerticalGrid

   type, extends(VerticalGrid) :: BasicVerticalGrid
      private
      integer :: num_levels = 0
   contains
      procedure :: get_num_levels
      procedure :: get_coordinate_field
      procedure :: can_connect_to
      procedure :: is_identical_to
      procedure :: write_formatted
   end type BasicVerticalGrid

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

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

   interface BasicVerticalGrid
      module procedure new_BasicVerticalGrid
   end interface BasicVerticalGrid

contains

   function new_BasicVerticalGrid(num_levels) result(vertical_grid)
      type(BasicVerticalGrid) :: vertical_grid
      integer, intent(in) :: num_levels
      call vertical_grid%set_id()
      vertical_grid%num_levels = num_levels
   end function

   function get_num_levels(this) result(num_levels)
      integer :: num_levels
      class(BasicVerticalGrid), intent(in) :: this
      num_levels = this%num_levels
   end function

   subroutine get_coordinate_field(this, field, coupler, standard_name, geom, typekind, units, vertical_dim_spec, rc)
      class(BasicVerticalGrid), intent(in) :: this
      type(ESMF_Field), intent(out) :: field
      class(ComponentDriver), 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

      _FAIL('BasicVerticalGrid should have been connected to a different subclass before this is called.')

      _UNUSED_DUMMY(this)
      _UNUSED_DUMMY(field)
      _UNUSED_DUMMY(coupler)
      _UNUSED_DUMMY(standard_name)
      _UNUSED_DUMMY(geom)
      _UNUSED_DUMMY(typekind)
      _UNUSED_DUMMY(units)
      _UNUSED_DUMMY(vertical_dim_spec)
   end subroutine get_coordinate_field

   logical function can_connect_to(this, dst, rc)
      class(BasicVerticalGrid), intent(in) :: this
      class(VerticalGrid), intent(in) :: dst
      integer, optional, intent(out) :: rc

      if (this%same_id(dst)) then
         can_connect_to = .true.
         _RETURN(_SUCCESS)
      end if

      _FAIL("BasicVerticalGrid::can_connect_to - NOT implemented yet")
   end function can_connect_to

   logical function is_identical_to(this, that, rc)
      class(BasicVerticalGrid), intent(in) :: this
      class(VerticalGrid), allocatable, intent(in) :: that
      integer, optional, intent(out) :: rc

      is_identical_to = .false.

      ! Mirror grid
      if (.not. allocated(that)) then
         is_identical_to = .true.
         _RETURN(_SUCCESS) ! mirror grid
      end if

      ! Same id
      is_identical_to = this%same_id(that)
      if (is_identical_to) then
         _RETURN(_SUCCESS)
      end if

      select type(that)
      type is(BasicVerticalGrid)
         is_identical_to = (this == that)
      end select

      _RETURN(_SUCCESS)
   end function is_identical_to

   elemental logical function equal_to(a, b)
      type(BasicVerticalGrid), intent(in) :: a, b
      equal_to = a%num_levels == b%num_levels
   end function equal_to

   elemental logical function not_equal_to(a, b)
      type(BasicVerticalGrid), intent(in) :: a, b
      not_equal_to = .not. (a == b)
   end function not_equal_to

   subroutine write_formatted(this, unit, iotype, v_list, iostat, iomsg)
      class(BasicVerticalGrid), intent(in) :: this
      integer, intent(in) :: unit
      character(*), intent(in) :: iotype
      integer, intent(in) :: v_list(:)
      integer, intent(out) :: iostat
      character(*), intent(inout) :: iomsg

      write(unit, "(a, a, g0, a)", iostat=iostat, iomsg=iomsg) &
           "BasicVerticalGrid(", &
           "num levels: ", this%num_levels, &
           ")"

      _UNUSED_DUMMY(iotype)
      _UNUSED_DUMMY(v_list)
   end subroutine write_formatted

end module mapl3g_BasicVerticalGrid