ESMF_DistGridRegDecomp.F90 Source File


This file depends on

sourcefile~~esmf_distgridregdecomp.f90~~EfferentGraph sourcefile~esmf_distgridregdecomp.f90 ESMF_DistGridRegDecomp.F90 sourcefile~esmf_f90interface.f90 ESMF_F90Interface.F90 sourcefile~esmf_distgridregdecomp.f90->sourcefile~esmf_f90interface.f90 sourcefile~esmf_initmacros.f90 ESMF_InitMacros.F90 sourcefile~esmf_distgridregdecomp.f90->sourcefile~esmf_initmacros.f90 sourcefile~esmf_logerr.f90 ESMF_LogErr.F90 sourcefile~esmf_distgridregdecomp.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_utiltypes.f90 ESMF_UtilTypes.F90 sourcefile~esmf_distgridregdecomp.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_vm.f90 ESMF_VM.F90 sourcefile~esmf_distgridregdecomp.f90->sourcefile~esmf_vm.f90 sourcefile~esmf_f90interface.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_f90interface.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_initmacros.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_initmacros.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_logerr.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_ioutil.f90 ESMF_IOUtil.F90 sourcefile~esmf_logerr.f90->sourcefile~esmf_ioutil.f90 sourcefile~esmf_utilstring.f90 ESMF_UtilString.F90 sourcefile~esmf_logerr.f90->sourcefile~esmf_utilstring.f90 sourcefile~esmf_vm.f90->sourcefile~esmf_f90interface.f90 sourcefile~esmf_vm.f90->sourcefile~esmf_initmacros.f90 sourcefile~esmf_vm.f90->sourcefile~esmf_logerr.f90 sourcefile~esmf_vm.f90->sourcefile~esmf_utiltypes.f90 sourcefile~esmf_vm.f90->sourcefile~esmf_ioutil.f90 sourcefile~esmf_ioutil.f90->sourcefile~esmf_utiltypes.f90

Files dependent on this one

sourcefile~~esmf_distgridregdecomp.f90~~AfferentGraph sourcefile~esmf_distgridregdecomp.f90 ESMF_DistGridRegDecomp.F90 sourcefile~esmf_distgrid.f90 ESMF_DistGrid.F90 sourcefile~esmf_distgrid.f90->sourcefile~esmf_distgridregdecomp.f90 sourcefile~esmf.f90 ESMF.F90 sourcefile~esmf.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_array.f90 ESMF_Array.F90 sourcefile~esmf_array.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_arrayha.f90 ESMF_ArrayHa.F90 sourcefile~esmf_arrayha.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_attribute.f90 ESMF_Attribute.F90 sourcefile~esmf_attribute.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_field.f90 ESMF_Field.F90 sourcefile~esmf_field.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_fieldpr.f90 ESMF_FieldPr.F90 sourcefile~esmf_fieldpr.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_fieldregrid.f90 ESMF_FieldRegrid.F90 sourcefile~esmf_fieldregrid.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_fieldset.f90 ESMF_FieldSet.F90 sourcefile~esmf_fieldset.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_fileregrid.f90 ESMF_FileRegrid.F90 sourcefile~esmf_fileregrid.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_fileregridcheck.f90 ESMF_FileRegridCheck.F90 sourcefile~esmf_fileregridcheck.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_geom.f90 ESMF_Geom.F90 sourcefile~esmf_geom.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_grid.f90 ESMF_Grid.F90 sourcefile~esmf_grid.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_grid_c.f90 ESMF_Grid_C.F90 sourcefile~esmf_grid_c.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_gridutil.f90 ESMF_GridUtil.F90 sourcefile~esmf_gridutil.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_infodescribe.f90 ESMF_InfoDescribe.F90 sourcefile~esmf_infodescribe.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_infosync.f90 ESMF_InfoSync.F90 sourcefile~esmf_infosync.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_ioscrip.f90 ESMF_IOScrip.F90 sourcefile~esmf_ioscrip.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_locstream.f90 ESMF_LocStream.F90 sourcefile~esmf_locstream.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_mesh.f90 ESMF_Mesh.F90 sourcefile~esmf_mesh.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_mesh_c.f90 ESMF_Mesh_C.F90 sourcefile~esmf_mesh_c.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_pointlist.f90 ESMF_PointList.F90 sourcefile~esmf_pointlist.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_regridweightgen.f90 ESMF_RegridWeightGen.F90 sourcefile~esmf_regridweightgen.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_regridweightgencheck.f90 ESMF_RegridWeightGenCheck.F90 sourcefile~esmf_regridweightgencheck.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_xgrid.f90 ESMF_XGrid.F90 sourcefile~esmf_xgrid.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_xgridcreate.f90 ESMF_XGridCreate.F90 sourcefile~esmf_xgridcreate.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_xgridgeombase.f90 ESMF_XGridGeomBase.F90 sourcefile~esmf_xgridgeombase.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmf_xgridget.f90 ESMF_XGridGet.F90 sourcefile~esmf_xgridget.f90->sourcefile~esmf_distgrid.f90 sourcefile~esmfio.f90 ESMFIO.F90 sourcefile~esmfio.f90->sourcefile~esmf_distgrid.f90

Source Code

! $Id$
!
! Earth System Modeling Framework
! Copyright (c) 2002-2025, University Corporation for Atmospheric Research, 
! Massachusetts Institute of Technology, Geophysical Fluid Dynamics 
! Laboratory, University of Michigan, National Centers for Environmental 
! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, 
! NASA Goddard Space Flight Center.
! Licensed under the University of Illinois-NCSA License.
!
!==============================================================================
#define ESMF_FILENAME "ESMF_DistGridRegDecomp.F90"
!==============================================================================
!
! ESMF DistGrid Module
module ESMF_DistGridRegDecompMod
!
!==============================================================================
!
! This file contains the DistGridRegDecomp API implementation.
!
!------------------------------------------------------------------------------
! INCLUDES
#include "ESMF.h"

!==============================================================================
!BOPI
! !MODULE: ESMF_DistGridRegDecompMod
!
!------------------------------------------------------------------------------

! !USES:
  use ESMF_UtilTypesMod           ! ESMF utility types
  use ESMF_InitMacrosMod          ! ESMF initializer macros
  use ESMF_LogErrMod              ! ESMF error handling
  use ESMF_F90InterfaceMod        ! ESMF F90-C++ interface helper
  use ESMF_VMMod
  
  implicit none

!------------------------------------------------------------------------------
! !PRIVATE TYPES:
  private

!------------------------------------------------------------------------------
!
! !PUBLIC MEMBER FUNCTIONS:

! - ESMF-public methods:

  public ESMF_DistGridRegDecompSetCubic
  

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

contains

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


! -------------------------- ESMF-public method -------------------------------
#undef  ESMF_METHOD
#define ESMF_METHOD "ESMF_DistGridRegDecompSetCubic()"
!BOP
! !IROUTINE: ESMF_DistGridRegDecompSetCubic - Construct a DistGrid regDecomp
! !INTERFACE:
  subroutine ESMF_DistGridRegDecompSetCubic(regDecomp, deCount, keywordEnforcer, rc)
!
! !ARGUMENTS:
    integer,        target, intent(out)           :: regDecomp(:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    integer,                intent(in),  optional :: deCount
    integer,                intent(out), optional :: rc
!
! !DESCRIPTION:
!   Construct a regular decomposition argument for DistGrid that is most cubic
!   in {\tt dimCount} dimensions, and multiplies out to {\tt deCount} DEs. The
!   factorization is stable monotonic decreasing, ensuring that earlier entries
!   in {\tt regDecomp} are larger or equal to the later entires.
!
!   The arguments are:
!   \begin{description}
!   \item[regDecomp]
!     The regular decomposition description being constructed.
!   \item[{[deCount]}]
!     The number of DEs. Defaults to {\tt petCount}.
!   \item[{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOP
!------------------------------------------------------------------------------
    integer               :: localrc      ! local return code
    type(ESMF_InterArray) :: regDecompArg ! helper variable
    integer               :: optDeCount   ! helper variable
    type(ESMF_VM)         :: vm           ! helper variable

    ! initialize return code; assume routine not implemented
    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! create InterArrays
    regDecompArg = ESMF_InterArrayCreate(regDecomp, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! Deal with optional arguments
    if (present(deCount)) then
      optDeCount = deCount
    else
      call ESMF_VMGetCurrent(vm, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      call ESMF_VMGet(vm, petCount=optDeCount, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    endif
    
    ! call into the C++ interface, which will sort out optional arguments
    call c_ESMC_DistGridRDSetCubic(regDecompArg, optDeCount, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
      
    ! return successfully
    if (present(rc)) rc = ESMF_SUCCESS
 
  end subroutine ESMF_DistGridRegDecompSetCubic
!------------------------------------------------------------------------------

end module ESMF_DistGridRegDecompMod