AspectCollection.F90 Source File


This file depends on

sourcefile~~aspectcollection.f90~~EfferentGraph sourcefile~aspectcollection.f90 AspectCollection.F90 sourcefile~attributesaspect.f90 AttributesAspect.F90 sourcefile~aspectcollection.f90->sourcefile~attributesaspect.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~aspectcollection.f90->sourcefile~errorhandling.f90 sourcefile~frequencyaspect.f90 FrequencyAspect.F90 sourcefile~aspectcollection.f90->sourcefile~frequencyaspect.f90 sourcefile~geomaspect.f90 GeomAspect.F90 sourcefile~aspectcollection.f90->sourcefile~geomaspect.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~aspectcollection.f90->sourcefile~keywordenforcer.f90 sourcefile~stateitemaspect.f90 StateItemAspect.F90 sourcefile~aspectcollection.f90->sourcefile~stateitemaspect.f90 sourcefile~typekindaspect.f90 TypekindAspect.F90 sourcefile~aspectcollection.f90->sourcefile~typekindaspect.f90 sourcefile~ungriddeddimsaspect.f90 UngriddedDimsAspect.F90 sourcefile~aspectcollection.f90->sourcefile~ungriddeddimsaspect.f90 sourcefile~unitsaspect.f90 UnitsAspect.F90 sourcefile~aspectcollection.f90->sourcefile~unitsaspect.f90 sourcefile~verticalgridaspect.f90 VerticalGridAspect.F90 sourcefile~aspectcollection.f90->sourcefile~verticalgridaspect.f90 sourcefile~attributesaspect.f90->sourcefile~errorhandling.f90 sourcefile~attributesaspect.f90->sourcefile~stateitemaspect.f90 sourcefile~extensionaction.f90 ExtensionAction.F90 sourcefile~attributesaspect.f90->sourcefile~extensionaction.f90 sourcefile~nullaction.f90 NullAction.F90 sourcefile~attributesaspect.f90->sourcefile~nullaction.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~frequencyaspect.f90->sourcefile~stateitemaspect.f90 sourcefile~accumulatoractioninterface.f90 AccumulatorActionInterface.F90 sourcefile~frequencyaspect.f90->sourcefile~accumulatoractioninterface.f90 sourcefile~frequencyaspect.f90->sourcefile~extensionaction.f90 sourcefile~geomaspect.f90->sourcefile~errorhandling.f90 sourcefile~geomaspect.f90->sourcefile~stateitemaspect.f90 sourcefile~geomaspect.f90->sourcefile~extensionaction.f90 sourcefile~geom_mgr.f90 geom_mgr.F90 sourcefile~geomaspect.f90->sourcefile~geom_mgr.f90 sourcefile~horizontaldimsspec.f90 HorizontalDimsSpec.F90 sourcefile~geomaspect.f90->sourcefile~horizontaldimsspec.f90 sourcefile~geomaspect.f90->sourcefile~nullaction.f90 sourcefile~regridaction.f90 RegridAction.F90 sourcefile~geomaspect.f90->sourcefile~regridaction.f90 sourcefile~regridder_mgr.f90 regridder_mgr.F90 sourcefile~geomaspect.f90->sourcefile~regridder_mgr.f90 sourcefile~stateitemaspect.f90->sourcefile~errorhandling.f90 sourcefile~typekindaspect.f90->sourcefile~errorhandling.f90 sourcefile~typekindaspect.f90->sourcefile~stateitemaspect.f90 sourcefile~copyaction.f90 CopyAction.F90 sourcefile~typekindaspect.f90->sourcefile~copyaction.f90 sourcefile~esmf_utilities.f90 ESMF_Utilities.F90 sourcefile~typekindaspect.f90->sourcefile~esmf_utilities.f90 sourcefile~typekindaspect.f90->sourcefile~extensionaction.f90 sourcefile~typekindaspect.f90->sourcefile~nullaction.f90 sourcefile~ungriddeddimsaspect.f90->sourcefile~errorhandling.f90 sourcefile~ungriddeddimsaspect.f90->sourcefile~stateitemaspect.f90 sourcefile~ungriddeddimsaspect.f90->sourcefile~extensionaction.f90 sourcefile~ungriddeddimsaspect.f90->sourcefile~nullaction.f90 sourcefile~ungriddeddims.f90 UngriddedDims.F90 sourcefile~ungriddeddimsaspect.f90->sourcefile~ungriddeddims.f90 sourcefile~unitsaspect.f90->sourcefile~errorhandling.f90 sourcefile~unitsaspect.f90->sourcefile~stateitemaspect.f90 sourcefile~convertunitsaction.f90 ConvertUnitsAction.F90 sourcefile~unitsaspect.f90->sourcefile~convertunitsaction.f90 sourcefile~unitsaspect.f90->sourcefile~extensionaction.f90 sourcefile~unitsaspect.f90->sourcefile~nullaction.f90 sourcefile~udunits2f.f90 udunits2f.F90 sourcefile~unitsaspect.f90->sourcefile~udunits2f.f90 sourcefile~verticalgridaspect.f90->sourcefile~errorhandling.f90 sourcefile~verticalgridaspect.f90->sourcefile~stateitemaspect.f90 sourcefile~componentdriver.f90 ComponentDriver.F90 sourcefile~verticalgridaspect.f90->sourcefile~componentdriver.f90 sourcefile~verticalgridaspect.f90->sourcefile~extensionaction.f90 sourcefile~verticalgridaspect.f90->sourcefile~nullaction.f90 sourcefile~verticaldimspec.f90 VerticalDimSpec.F90 sourcefile~verticalgridaspect.f90->sourcefile~verticaldimspec.f90 sourcefile~verticalgrid.f90 VerticalGrid.F90 sourcefile~verticalgridaspect.f90->sourcefile~verticalgrid.f90 sourcefile~verticalregridaction.f90 VerticalRegridAction.F90 sourcefile~verticalgridaspect.f90->sourcefile~verticalregridaction.f90 sourcefile~verticalregridmethod.f90 VerticalRegridMethod.F90 sourcefile~verticalgridaspect.f90->sourcefile~verticalregridmethod.f90

Files dependent on this one

sourcefile~~aspectcollection.f90~~AfferentGraph sourcefile~aspectcollection.f90 AspectCollection.F90 sourcefile~fieldspec.f90 FieldSpec.F90 sourcefile~fieldspec.f90->sourcefile~aspectcollection.f90 sourcefile~mockitemspec.f90 MockItemSpec.F90 sourcefile~mockitemspec.f90->sourcefile~aspectcollection.f90 sourcefile~stateitemspec.f90 StateItemSpec.F90 sourcefile~stateitemspec.f90->sourcefile~aspectcollection.f90 sourcefile~test_fieldspec.pf Test_FieldSpec.pf sourcefile~test_fieldspec.pf->sourcefile~aspectcollection.f90 sourcefile~variablespec.f90 VariableSpec.F90 sourcefile~variablespec.f90->sourcefile~aspectcollection.f90 sourcefile~wildcardspec.f90 WildcardSpec.F90 sourcefile~wildcardspec.f90->sourcefile~aspectcollection.f90

Source Code

#include "MAPL_Generic.h"

module mapl3g_AspectCollection
   use mapl3g_StateItemAspect
   use mapl3g_GeomAspect
   use mapl3g_VerticalGridAspect
   use mapl3g_UnitsAspect
   use mapl3g_TypekindAspect
   use mapl3g_FrequencyAspect
   use mapl3g_UngriddedDimsAspect
   use mapl3g_AttributesAspect
   use mapl_KeywordEnforcer
   use mapl_ErrorHandling
   use esmf
   implicit none
   private

   public :: AspectCollection

   type AspectCollection
      private
      type(GeomAspect), allocatable :: geom_aspect
      type(VerticalGridAspect), allocatable :: vertical_grid_aspect
      type(UnitsAspect), allocatable :: units_aspect
      type(TypekindAspect), allocatable :: typekind_aspect
      type(UngriddedDimsAspect), allocatable :: ungridded_dims_aspect
      type(AttributesAspect), allocatable :: attributes_aspect
      type(FrequencyAspect), allocatable :: frequency_aspect
   contains
      procedure :: get_aspect ! polymorphic
      procedure :: has_aspect ! polymorphic
      procedure :: set_aspect ! polymorphic

      procedure :: get_geom_aspect
      procedure :: set_geom_aspect

      procedure :: get_vertical_grid_aspect
      procedure :: set_vertical_grid_aspect

      procedure :: get_units_aspect
      procedure :: set_units_aspect

      procedure :: get_typekind_aspect
      procedure :: set_typekind_aspect

      procedure :: get_ungridded_dims_aspect
      procedure :: set_ungridded_dims_aspect
 
      procedure :: get_attributes_aspect
      procedure :: set_attributes_aspect
      
      procedure :: get_frequency_aspect
      procedure :: set_frequency_aspect
   end type AspectCollection

   interface AspectCollection
      procedure :: new_AspectCollection
   end interface AspectCollection
   
contains

   function new_AspectCollection( unusable, &
        geom_aspect &
        ) result(collection)
      type(AspectCollection) :: collection
      class(KeywordEnforcer), optional, intent(in) :: unusable
      type(GeomAspect), optional, intent(in) :: geom_aspect

      if (present(geom_aspect)) then
         collection%geom_aspect = geom_aspect
      end if

      _UNUSED_DUMMY(unusable)
   end function new_AspectCollection

   function get_aspect(this, name, rc) result(aspect)
      class(StateItemAspect), pointer :: aspect
      class(AspectCollection), target :: this
      character(*), intent(in) :: name
      integer, optional, intent(out) :: rc

      aspect => null()
      select case (name)
      case ('GEOM')
         aspect => this%get_geom_aspect()
      case ('VERTICAL')
         aspect => this%get_vertical_grid_aspect()
      case ('UNITS')
         aspect => this%get_units_aspect()
      case ('TYPEKIND')
         aspect => this%get_typekind_aspect()
      case ('UNGRIDDED_DIMS')
         aspect => this%get_ungridded_dims_aspect()
      case ('ATTRIBUTES')
         aspect => this%get_attributes_aspect()
      case ('FREQUENCY')
         aspect => this%get_frequency_aspect()
      case default
         _FAIL('unknown aspect type: '//name)
      end select

      _RETURN(_SUCCESS)
   end function get_aspect

   logical function has_aspect(this, name)
      class(AspectCollection), target :: this
      character(*), intent(in) :: name

      select case (name)

      case ('GEOM')
         has_aspect = allocated(this%geom_aspect)
      case ('VERTICAL')
         has_aspect = allocated(this%vertical_grid_aspect)
      case ('UNITS')
         has_aspect = allocated(this%units_aspect)
      case ('TYPEKIND')
         has_aspect = allocated(this%typekind_aspect)
      case ('UNGRIDDED_DIMS')
         has_aspect = allocated(this%ungridded_dims_aspect)
      case ('ATTRIBUTES')
         has_aspect = allocated(this%attributes_aspect)
      case ('FREQUENCY')
         has_aspect = allocated(this%frequency_aspect)
      case default
         has_aspect = .false.
      end select

   end function has_aspect

   subroutine set_aspect(this, aspect, rc)
      class(AspectCollection), target :: this
      class(StateItemAspect), target, intent(in) :: aspect
      integer, optional, intent(out) :: rc

      type(ESMF_Geom) :: geom
      type(ESMF_Typekind_Flag) :: typekind
      integer :: status

      select type (aspect)
      type is (GeomAspect)
         this%geom_aspect = aspect
         ! aux vertical
         if (allocated( this%vertical_grid_aspect)) then
            geom = aspect%get_geom()
            call this%vertical_grid_aspect%set_geom(geom)
         end if
      type is (VerticalGridAspect)
         this%vertical_grid_aspect = aspect
      type is (UnitsAspect)
         this%units_aspect = aspect
      type is (TypekindAspect)
         this%typekind_aspect = aspect
         ! aux vertical
         typekind = aspect%get_typekind()
         if (allocated( this%vertical_grid_aspect)) then
            call this%vertical_grid_aspect%set_typekind(typekind)
         end if
      type is (UngriddedDimsAspect)
         this%ungridded_dims_aspect = aspect
      type is (AttributesAspect)
         this%attributes_aspect = aspect
      type is (FrequencyAspect)
         this%frequency_aspect = aspect
      class default
         _FAIL('unsupported aspect type: ')
      end select
         
      _RETURN(_SUCCESS)
   end subroutine set_aspect

   function get_geom_aspect(this) result(geom_aspect)
      type(GeomAspect), pointer :: geom_aspect
      class(AspectCollection), target, intent(in) :: this
      geom_aspect => null()
      if (allocated(this%geom_aspect)) then
         geom_aspect => this%geom_aspect
      end if
   end function get_geom_aspect

   subroutine set_geom_aspect(this, geom_aspect)
      class(AspectCollection), intent(inout) :: this
      type(GeomAspect), intent(in) :: geom_aspect
      this%geom_aspect = geom_aspect
   end subroutine set_geom_aspect

   function get_vertical_grid_aspect(this) result(vertical_grid_aspect)
      type(VerticalGridAspect), pointer :: vertical_grid_aspect
      class(AspectCollection), target, intent(in) :: this
      vertical_grid_aspect => null()
      if (allocated(this%vertical_grid_aspect)) then
         vertical_grid_aspect => this%vertical_grid_aspect
      end if
   end function get_vertical_grid_aspect

   subroutine set_vertical_grid_aspect(this, vertical_grid_aspect)
      class(AspectCollection), intent(inout) :: this
      type(VerticalGridAspect), intent(in) :: vertical_grid_aspect
      this%vertical_grid_aspect = vertical_grid_aspect
   end subroutine set_vertical_grid_aspect

   function get_units_aspect(this) result(units_aspect)
      type(UnitsAspect), pointer :: units_aspect
      class(AspectCollection), target, intent(in) :: this
      units_aspect => null()
      if (allocated(this%units_aspect)) then
         units_aspect => this%units_aspect
      end if
   end function get_units_aspect

   subroutine set_units_aspect(this, units_aspect)
      class(AspectCollection), intent(inout) :: this
      type(UnitsAspect), intent(in) :: units_aspect
      this%units_aspect = units_aspect
   end subroutine set_units_aspect

   function get_typekind_aspect(this) result(typekind_aspect)
      type(TypekindAspect), pointer :: typekind_aspect
      class(AspectCollection), target, intent(in) :: this

      typekind_aspect => null()
      if (allocated(this%typekind_aspect)) then
         typekind_aspect => this%typekind_aspect
      end if
   end function get_typekind_aspect

   subroutine set_typekind_aspect(this, typekind_aspect)
      class(AspectCollection), intent(inout) :: this
      type(TypekindAspect), intent(in) :: typekind_aspect
      this%typekind_aspect = typekind_aspect
   end subroutine set_typekind_aspect

   function get_ungridded_dims_aspect(this) result(ungridded_dims_aspect)
      type(UngriddedDimsAspect), pointer :: ungridded_dims_aspect
      class(AspectCollection), target, intent(in) :: this
      ungridded_dims_aspect => null()
      if (allocated(this%ungridded_dims_aspect)) then
         ungridded_dims_aspect => this%ungridded_dims_aspect
      end if
   end function get_ungridded_dims_aspect

   subroutine set_ungridded_dims_aspect(this, ungridded_dims_aspect)
      class(AspectCollection), intent(inout) :: this
      type(UngriddedDimsAspect), intent(in) :: ungridded_dims_aspect
      this%ungridded_dims_aspect = ungridded_dims_aspect
   end subroutine set_ungridded_dims_aspect

   function get_attributes_aspect(this) result(attributes_aspect)
      type(AttributesAspect), pointer :: attributes_aspect
      class(AspectCollection), target, intent(in) :: this
      attributes_aspect => null()
      if (allocated(this%attributes_aspect)) then
         attributes_aspect => this%attributes_aspect
      end if
   end function get_attributes_aspect

   subroutine set_attributes_aspect(this, attributes_aspect)
      class(AspectCollection), intent(inout) :: this
      type(AttributesAspect), intent(in) :: attributes_aspect
      this%attributes_aspect = attributes_aspect
   end subroutine set_attributes_aspect
  
   function get_frequency_aspect(this) result(frequency_aspect)
      type(FrequencyAspect), pointer :: frequency_aspect
      class(AspectCollection), target, intent(inout) :: this
      frequency_aspect => null()
      if(allocated(this%frequency_aspect)) then
         frequency_aspect => this%frequency_aspect
      end if
   end function get_frequency_aspect

   subroutine set_frequency_aspect(this, frequency_aspect)
      class(AspectCollection), intent(inout) :: this
      type(FrequencyAspect), intent(in) :: frequency_aspect
      this%frequency_aspect = frequency_aspect
   end subroutine set_frequency_aspect

end module mapl3g_AspectCollection