MAPL_IdentityRegridder.F90 Source File


This file depends on

sourcefile~~mapl_identityregridder.f90~~EfferentGraph sourcefile~mapl_identityregridder.f90 MAPL_IdentityRegridder.F90 sourcefile~base_base.f90 Base_Base.F90 sourcefile~mapl_identityregridder.f90->sourcefile~base_base.f90 sourcefile~mapl_abstractregridder.f90 MAPL_AbstractRegridder.F90 sourcefile~mapl_identityregridder.f90->sourcefile~mapl_abstractregridder.f90 sourcefile~mapl_comms.f90 MAPL_Comms.F90 sourcefile~mapl_identityregridder.f90->sourcefile~mapl_comms.f90 sourcefile~mapl_errorhandling.f90 MAPL_ErrorHandling.F90 sourcefile~mapl_identityregridder.f90->sourcefile~mapl_errorhandling.f90 sourcefile~mapl_gridspec.f90 MAPL_GridSpec.F90 sourcefile~mapl_identityregridder.f90->sourcefile~mapl_gridspec.f90 sourcefile~mapl_keywordenforcer.f90 MAPL_KeywordEnforcer.F90 sourcefile~mapl_identityregridder.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~regridderspec.f90 RegridderSpec.F90 sourcefile~mapl_identityregridder.f90->sourcefile~regridderspec.f90 sourcefile~regridmethods.f90 RegridMethods.F90 sourcefile~mapl_identityregridder.f90->sourcefile~regridmethods.f90 sourcefile~base_base.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~constants.f90 Constants.F90 sourcefile~base_base.f90->sourcefile~constants.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~mapl_abstractregridder.f90->sourcefile~base_base.f90 sourcefile~mapl_abstractregridder.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~mapl_abstractregridder.f90->sourcefile~regridderspec.f90 sourcefile~mapl_abstractregridder.f90->sourcefile~constants.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~mapl_abstractregridder.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~mapl_memutils.f90 MAPL_MemUtils.F90 sourcefile~mapl_abstractregridder.f90->sourcefile~mapl_memutils.f90 sourcefile~regridderspecroutehandlemap.f90 RegridderSpecRouteHandleMap.F90 sourcefile~mapl_abstractregridder.f90->sourcefile~regridderspecroutehandlemap.f90 sourcefile~mapl_comms.f90->sourcefile~base_base.f90 sourcefile~mapl_comms.f90->sourcefile~constants.f90 sourcefile~mapl_comms.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~shmem.f90 Shmem.F90 sourcefile~mapl_comms.f90->sourcefile~shmem.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~mapl_errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~mapl_gridtype.f90 MAPL_GridType.F90 sourcefile~mapl_gridspec.f90->sourcefile~mapl_gridtype.f90 sourcefile~regridderspec.f90->sourcefile~mapl_errorhandling.f90 sourcefile~regridderspec.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~regridderspec.f90->sourcefile~regridmethods.f90 sourcefile~mapl_gridmanager.f90 MAPL_GridManager.F90 sourcefile~regridderspec.f90->sourcefile~mapl_gridmanager.f90

Files dependent on this one

sourcefile~~mapl_identityregridder.f90~~AfferentGraph sourcefile~mapl_identityregridder.f90 MAPL_IdentityRegridder.F90 sourcefile~mapl_regriddermanager.f90 MAPL_RegridderManager.F90 sourcefile~mapl_regriddermanager.f90->sourcefile~mapl_identityregridder.f90 sourcefile~newregriddermanager.f90 NewRegridderManager.F90 sourcefile~newregriddermanager.f90->sourcefile~mapl_identityregridder.f90 sourcefile~base.f90 Base.F90 sourcefile~base.f90->sourcefile~mapl_regriddermanager.f90 sourcefile~base.f90->sourcefile~newregriddermanager.f90 sourcefile~mapl_cfio.f90 MAPL_CFIO.F90 sourcefile~base.f90->sourcefile~mapl_cfio.f90 sourcefile~griddedio.f90 GriddedIO.F90 sourcefile~griddedio.f90->sourcefile~newregriddermanager.f90 sourcefile~mapl_cfio.f90->sourcefile~mapl_regriddermanager.f90 sourcefile~mapl_cfio.f90->sourcefile~newregriddermanager.f90 sourcefile~mapl_epochswathmod.f90 MAPL_EpochSwathMod.F90 sourcefile~mapl_epochswathmod.f90->sourcefile~newregriddermanager.f90 sourcefile~regrid_util.f90 Regrid_Util.F90 sourcefile~regrid_util.f90->sourcefile~newregriddermanager.f90 sourcefile~regrid_util.f90->sourcefile~mapl_cfio.f90 sourcefile~extdata_iobundlemod.f90 ExtData_IOBundleMod.F90 sourcefile~extdata_iobundlemod.f90->sourcefile~griddedio.f90 sourcefile~extdata_iobundlemod.f90~2 ExtData_IOBundleMod.F90 sourcefile~extdata_iobundlemod.f90~2->sourcefile~griddedio.f90 sourcefile~extdatadrivermod.f90 ExtDataDriverMod.F90 sourcefile~extdatadrivermod.f90->sourcefile~mapl_cfio.f90 sourcefile~extdatagridcompmod.f90 ExtDataGridCompMod.F90 sourcefile~extdatagridcompmod.f90->sourcefile~mapl_cfio.f90 sourcefile~extdatagridcompng.f90 ExtDataGridCompNG.F90 sourcefile~extdatagridcompng.f90->sourcefile~mapl_cfio.f90 sourcefile~fieldbundleread.f90 FieldBundleRead.F90 sourcefile~fieldbundleread.f90->sourcefile~griddedio.f90 sourcefile~fieldbundlewrite.f90 FieldBundleWrite.F90 sourcefile~fieldbundlewrite.f90->sourcefile~griddedio.f90 sourcefile~mapl.f90 MAPL.F90 sourcefile~mapl.f90->sourcefile~base.f90 sourcefile~mapl_cap.f90 MAPL_Cap.F90 sourcefile~mapl_cap.f90->sourcefile~mapl_cfio.f90 sourcefile~mapl_historycollection.f90 MAPL_HistoryCollection.F90 sourcefile~mapl_historycollection.f90->sourcefile~griddedio.f90 sourcefile~mapl_historycollection.f90->sourcefile~mapl_cfio.f90 sourcefile~mapl_historycollection.f90->sourcefile~mapl_epochswathmod.f90 sourcefile~mapl_historygridcomp.f90 MAPL_HistoryGridComp.F90 sourcefile~mapl_historygridcomp.f90->sourcefile~mapl_cfio.f90 sourcefile~mapl_historygridcomp.f90->sourcefile~mapl_epochswathmod.f90 sourcefile~mapl_nuopcwrappermod.f90 MAPL_NUOPCWrapperMod.F90 sourcefile~mapl_nuopcwrappermod.f90->sourcefile~base.f90 sourcefile~mapl_simplebundlemod.f90 MAPL_SimpleBundleMod.F90 sourcefile~mapl_simplebundlemod.f90->sourcefile~mapl_cfio.f90 sourcefile~test_cfio_bundle.pf Test_CFIO_Bundle.pf sourcefile~test_cfio_bundle.pf->sourcefile~base.f90 sourcefile~tstqsat.f90 tstqsat.F90 sourcefile~tstqsat.f90->sourcefile~base.f90 sourcefile~ut_extdata.f90 ut_ExtData.F90 sourcefile~ut_extdata.f90->sourcefile~base.f90 sourcefile~utcfio_array.f90 utCFIO_Array.F90 sourcefile~utcfio_array.f90->sourcefile~mapl_cfio.f90 sourcefile~utcfio_bundle.f90 utCFIO_Bundle.F90 sourcefile~utcfio_bundle.f90->sourcefile~base.f90 sourcefile~utcfio_nbits.f90 utCFIO_Nbits.F90 sourcefile~utcfio_nbits.f90->sourcefile~mapl_cfio.f90

Source Code

#include "MAPL_Generic.h"

module MAPL_IdentityRegridderMod
   use MAPL_AbstractRegridderMod
   use MAPL_GridSpecMod
   use MAPL_RegridderSpec
   use MAPL_KeywordEnforcerMod
   use mapl_ErrorHandlingMod
   use mapl_RegridMethods
   use ESMF

   use, intrinsic :: iso_fortran_env, only: REAL32
   implicit none
   private

   !----------------------------
   ! Note this module implements the singleton pattern.  The type is
   ! PRIVATE, which prevents other modules from creating objects of
   ! that type.  The identity_regridder() procedure is PUBLIC and
   ! returns a pointer to the singleton object.
   !----------------------------
   public :: identity_regridder

   integer, parameter :: NUM_DIMS = 2

   type, extends(AbstractRegridder) :: IdentityRegridder
      private
      logical :: initialized
   contains
      procedure :: initialize_subclass
      procedure :: regrid_scalar_2d_real32
      procedure :: regrid_scalar_3d_real32
      procedure :: regrid_vector_2d_real32
      procedure :: regrid_vector_3d_real32
   end type IdentityRegridder

   character(len=*), parameter :: MOD_NAME = 'MAPL_IdentityRegridder::'

   type (IdentityRegridder), save, target :: singleton

contains


   function identity_regridder() result(regridder)
      use ESMF
      type (IdentityRegridder), pointer :: regridder
      type (RegridderSpec) :: spec

      regridder => singleton

      ! Due to how MAPL is set up, the default regrid_method is
      ! bilinear. But if an identity regridder is requested, we
      ! want to reflect that in the metadata by updating the spec.
      spec = regridder%get_spec()
      spec%regrid_method = REGRID_METHOD_IDENTITY
      call regridder%set_spec(spec)
    end function identity_regridder


   subroutine regrid_scalar_2d_real32(this, q_in, q_out, rc)
      class (IdentityRegridder), intent(in) :: this
      real (kind=REAL32), intent(in) :: q_in(:,:)
      real (kind=REAL32), intent(out) :: q_out(:,:)
      integer, optional, intent(out) :: rc

      character(len=*), parameter :: Iam = MOD_NAME//'regrid_scalar_2d_real32'

      _UNUSED_DUMMY(this)

      q_out = q_in

      _RETURN(_SUCCESS)

   end subroutine regrid_scalar_2d_real32


   subroutine regrid_scalar_3d_real32(this, q_in, q_out, rc)
      use MAPL_CommsMod
      use MAPL_BaseMod

      class (IdentityRegridder), intent(in) :: this
      real (kind=REAL32), intent(in) :: q_in(:,:,:)
      real (kind=REAL32), intent(out) :: q_out(:,:,:)
      integer, optional, intent(out) :: rc

      character(len=*), parameter :: Iam = MOD_NAME//'regrid_scalar_2d_real32'

      _UNUSED_DUMMY(this)

      _ASSERT(size(q_in,3) == size(q_out,3), 'inconsistent array shape')

      q_out = q_in

      _RETURN(_SUCCESS)

   end subroutine regrid_scalar_3d_real32

   subroutine regrid_vector_2d_real32(this, u_in, v_in, u_out, v_out, rotate, rc)
      use MAPL_CommsMod
      use MAPL_BaseMod
      use, intrinsic :: iso_fortran_env, only: REAL32
      class (IdentityRegridder), intent(in) :: this
      real(kind=REAL32), intent(in) :: u_in(:,:)
      real(kind=REAL32), intent(in) :: v_in(:,:)
      real(kind=REAL32), intent(out) :: u_out(:,:)
      real(kind=REAL32), intent(out) :: v_out(:,:)
      logical, optional, intent(in) :: rotate
      integer, optional, intent(out) :: rc

      character(len=*), parameter :: Iam = MOD_NAME//'regrid_vector_3d_real32'

      _UNUSED_DUMMY(this)
      _UNUSED_DUMMY(rotate)

      u_out = u_in
      v_out = v_in

     _RETURN(_SUCCESS)

   end subroutine regrid_vector_2d_real32


   subroutine regrid_vector_3d_real32(this, u_in, v_in, u_out, v_out, rotate, rc)
      use MAPL_CommsMod
      use MAPL_BaseMod
      use, intrinsic :: iso_fortran_env, only: REAL32
      class (IdentityRegridder), intent(in) :: this
      real(kind=REAL32), intent(in) :: u_in(:,:,:)
      real(kind=REAL32), intent(in) :: v_in(:,:,:)
      real(kind=REAL32), intent(out) :: u_out(:,:,:)
      real(kind=REAL32), intent(out) :: v_out(:,:,:)
      logical, optional, intent(in) :: rotate
      integer, optional, intent(out) :: rc

      character(len=*), parameter :: Iam = MOD_NAME//'regrid_vector_3d_real32'

      _UNUSED_DUMMY(this)
      _UNUSED_DUMMY(rotate)

      _ASSERT(size(u_in,3) == size(u_out,3), 'inconsistent array shape')
      _ASSERT(size(v_in,3) == size(v_out,3), 'inconsistent array shape')
      _ASSERT(size(u_in,3) == size(v_in,3), 'inconsistent array shape')

      u_out = u_in
      v_out = v_in

     _RETURN(_SUCCESS)

   end subroutine regrid_vector_3d_real32

!$$
!$$   function clone(this)
!$$      class (AbstractRegridder), allocatable :: clone
!$$      class (IdentityRegridder), intent(in) :: this
!$$
!$$      ! We just need the type - not the details, so we copy an empty object.
!$$      type (IdentityRegridder) :: foo
!$$
!$$      allocate(clone, source=foo)
!$$
!$$   end function clone
!$$
   ! do nothing
   subroutine initialize_subclass(this, unusable, rc)
      use MAPL_KeywordEnforcerMod
      use MAPL_RegridderSpec
      class (IdentityRegridder), intent(inout) :: this
      class (KeywordEnforcer), optional, intent(in) :: unusable
      integer, optional, intent(out) :: rc

      character(len=*), parameter :: Iam = 'initialize_subclass'

      _UNUSED_DUMMY(this)
      _UNUSED_DUMMY(unusable)
      _UNUSED_DUMMY(rc)

   end subroutine initialize_subclass

end module MAPL_IdentityRegridderMod