ESMFL_FieldGetDims Subroutine

public subroutine ESMFL_FieldGetDims(FLD, gCPD, lCPD, lm, ar)

The subroutine ESMFL_FieldGetDims returns some grid information associated from an ESMF field.

History

  • 24Apr2006 Cruz Initial code.

Arguments

Type IntentOptional Attributes Name
type(ESMF_Field), intent(inout) :: FLD
integer, intent(out), optional :: gCPD(3)
integer, intent(out), optional :: lCPD(3)
integer, intent(out), optional :: lm
integer, intent(out), optional :: ar

Calls

proc~~esmfl_fieldgetdims~~CallsGraph proc~esmfl_fieldgetdims ESMFL_FieldGetDims ESMF_Finalize ESMF_Finalize proc~esmfl_fieldgetdims->ESMF_Finalize ESMF_VMGet ESMF_VMGet proc~esmfl_fieldgetdims->ESMF_VMGet ESMF_VMGetCurrent ESMF_VMGetCurrent proc~esmfl_fieldgetdims->ESMF_VMGetCurrent esmf_arrayget esmf_arrayget proc~esmfl_fieldgetdims->esmf_arrayget esmf_fieldget esmf_fieldget proc~esmfl_fieldgetdims->esmf_fieldget proc~mapl_gridget MAPL_GridGet proc~esmfl_fieldgetdims->proc~mapl_gridget ESMF_AttributeGet ESMF_AttributeGet proc~mapl_gridget->ESMF_AttributeGet ESMF_DistGridGet ESMF_DistGridGet proc~mapl_gridget->ESMF_DistGridGet ESMF_GridGet ESMF_GridGet proc~mapl_gridget->ESMF_GridGet proc~mapl_distgridget MAPL_DistGridGet proc~mapl_gridget->proc~mapl_distgridget proc~mapl_getimsjms MAPL_GetImsJms proc~mapl_gridget->proc~mapl_getimsjms proc~mapl_gridhasde MAPL_GridHasDE proc~mapl_gridget->proc~mapl_gridhasde proc~mapl_return MAPL_Return proc~mapl_gridget->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_gridget->proc~mapl_verify proc~mapl_distgridget->ESMF_DistGridGet proc~mapl_distgridget->proc~mapl_verify proc~mapl_getimsjms->proc~mapl_return proc~mapl_getimsjms->proc~mapl_verify interface~mapl_assert MAPL_Assert proc~mapl_getimsjms->interface~mapl_assert interface~mapl_sort MAPL_Sort proc~mapl_getimsjms->interface~mapl_sort proc~mapl_gridhasde->ESMF_DistGridGet proc~mapl_gridhasde->ESMF_GridGet proc~mapl_gridhasde->proc~mapl_return proc~mapl_gridhasde->proc~mapl_verify ESMF_DELayoutGet ESMF_DELayoutGet proc~mapl_gridhasde->ESMF_DELayoutGet at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

   subroutine ESMFL_FieldGetDims(FLD, gCPD, lCPD, lm, ar)
!
  implicit NONE

! !ARGUMENTS:

   type(ESMF_Field), intent(inout)         :: FLD !ALT: intent(in)
   integer, optional, intent(out)       :: gCPD(3)
   integer, optional, intent(out)       :: lCPD(3)
   integer, optional, intent(out)       :: lm
   integer, optional, intent(out)       :: ar
!
!-------------------------------------------------------------------------

! locals

   type(ESMF_VM)    :: vm
   type(ESMF_Grid)  :: GRID
   type(ESMF_Array) :: ARR
   integer          :: globalCPD(3)
   integer          :: localCPD(3)
   integer          :: status, thisrank, mype
   character(len=ESMF_MAXSTR), parameter :: IAm = 'ESMFL_FieldGetDims'

! start

   call ESMF_VMGetCurrent(vm)
   call ESMF_VMGet(vm, localPet=mype, rc=status)
   if (status /= ESMF_SUCCESS) call ESMFL_FailedRC(mype,Iam)

   call ESMF_FieldGet(FLD, grid=GRID, rc=status)
   if (status /= ESMF_SUCCESS) call ESMFL_FailedRC(mype,Iam)
   call MAPL_GridGet(GRID, &
        globalCellCountPerDim=globalCPD, &
        localCellCountPerDim=localCPD, &
        rc=status)
   if (status /= ESMF_SUCCESS) call ESMFL_FailedRC(mype,Iam)

   if (present(gCPD)) gCPD = globalCPD
   if (present(lCPD)) lCPD = localCPD

   call ESMF_FieldGet(FLD, Array=ARR, rc=status)
   if (status /= ESMF_SUCCESS) call ESMFL_FailedRC(mype,Iam)
   call ESMF_ArrayGet(ARR, RANK=thisrank, rc=status)
   if (status /= ESMF_SUCCESS) call ESMFL_FailedRC(mype,Iam)

   if (present(lm)) then
     if ( thisrank >= 3 ) then
       lm = globalCPD(3)
     else
       lm = 1
     end if
   end if

   if (present(ar)) ar = thisrank

   end subroutine ESMFL_FieldGetDims