checkGrid Subroutine

private subroutine checkGrid(grid, staggerloc, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid) :: grid
type(ESMF_StaggerLoc) :: staggerloc
integer, intent(out), optional :: rc

Calls

proc~~checkgrid~~CallsGraph proc~checkgrid checkGrid interface~esmf_gridget ESMF_GridGet proc~checkgrid->interface~esmf_gridget proc~esmf_gridgetdecomptype ESMF_GridGetDecompType proc~checkgrid->proc~esmf_gridgetdecomptype proc~esmf_logfounderror ESMF_LogFoundError proc~checkgrid->proc~esmf_logfounderror proc~esmf_logseterror ESMF_LogSetError proc~checkgrid->proc~esmf_logseterror proc~esmf_gridgetdefault ESMF_GridGetDefault interface~esmf_gridget->proc~esmf_gridgetdefault proc~esmf_gridgetplocalde ESMF_GridGetPLocalDe interface~esmf_gridget->proc~esmf_gridgetplocalde proc~esmf_gridgetplocaldepsloc ESMF_GridGetPLocalDePSloc interface~esmf_gridget->proc~esmf_gridgetplocaldepsloc proc~esmf_gridgetpsloc ESMF_GridGetPSloc interface~esmf_gridget->proc~esmf_gridgetpsloc proc~esmf_gridgetpslocptile ESMF_GridGetPSlocPTile interface~esmf_gridget->proc~esmf_gridgetpslocptile proc~esmf_gridgetdecomptype->proc~esmf_logfounderror c_esmc_gridgetdecomptype c_esmc_gridgetdecomptype proc~esmf_gridgetdecomptype->c_esmc_gridgetdecomptype esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_logseterror->esmf_breakpoint proc~esmf_logseterror->proc~esmf_logrc2msg proc~esmf_logseterror->proc~esmf_logwrite

Called by

proc~~checkgrid~~CalledByGraph proc~checkgrid checkGrid proc~b_or_p_gridtomesh b_or_p_GridToMesh proc~b_or_p_gridtomesh->proc~checkgrid proc~conserve_gridtomesh conserve_GridToMesh proc~conserve_gridtomesh->proc~checkgrid proc~esmf_fieldregridgetarea ESMF_FieldRegridGetArea proc~esmf_fieldregridgetarea->proc~checkgrid proc~esmf_fieldregridgetiwts ESMF_FieldRegridGetIwts proc~esmf_fieldregridgetiwts->proc~checkgrid

Source Code

    subroutine checkGrid(grid,staggerloc,rc)
        type (ESMF_Grid) :: grid
        type(ESMF_StaggerLoc) :: staggerloc
        integer, intent(out), optional :: rc
        type(ESMF_GridDecompType) :: decompType
        integer :: localDECount, lDE, ec(ESMF_MAXDIM)
        integer :: localrc, i, dimCount

        if (present(rc)) rc = ESMF_RC_NOT_IMPL

        ! Make sure Grid isn't arbitrarily distributed
        call ESMF_GridGetDecompType(grid, decompType, rc=localrc)
        if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return

       ! Error if decompType is ARBITRARY
       if (decompType .eq. ESMF_GRID_ARBITRARY) then
             call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_BAD, & 
               msg="- can't currently regrid an arbitrarily distributed Grid", & 
               ESMF_CONTEXT, rcToReturn=rc) 
             return
       endif        

       ! Make sure Grid doesn't contain width 1 DEs
       call ESMF_GridGet(grid,localDECount=localDECount, dimCount=dimCount, &
              rc=localrc)
       if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
         ESMF_CONTEXT, rcToReturn=rc)) return
       
       ! loop through checking DEs
       do lDE=0,localDECount-1
           
           ! Get bounds of DE
           call ESMF_GridGet(grid,staggerloc=staggerloc, localDE=lDE, &
                  exclusivecount=ec,rc=localrc)
           if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
             ESMF_CONTEXT, rcToReturn=rc)) return

           ! loop and make sure they aren't too small in any dimension
           do i=1,dimCount
              if (ec(i) .eq. 1) then
                 call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_BAD, & 
        msg=" some types of regridding (e.g. bilinear) are not supported on Grids that contain a DE of width 1.", & 
                 ESMF_CONTEXT, rcToReturn=rc) 
              return
              endif
           enddo
       enddo

       if(present(rc)) rc = ESMF_SUCCESS
   end subroutine checkGrid