ESMF_EsmfInq Subroutine

public subroutine ESMF_EsmfInq(filename, nodeCount, elementCount, maxNodePElement, coordDim, haveNodeMask, haveElmtMask, haveArea, haveOrigGridDims, origGridDims, rc)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
integer, intent(out), optional :: nodeCount
integer, intent(out), optional :: elementCount
integer, intent(out), optional :: maxNodePElement
integer, intent(out), optional :: coordDim
logical, intent(out), optional :: haveNodeMask
logical, intent(out), optional :: haveElmtMask
logical, intent(out), optional :: haveArea
logical, intent(out), optional :: haveOrigGridDims
integer, intent(out), optional :: origGridDims(2)
integer, intent(out), optional :: rc

Calls

proc~~esmf_esmfinq~~CallsGraph proc~esmf_esmfinq ESMF_EsmfInq proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_esmfinq->proc~esmf_logfounderror 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 c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_logopenfile->proc~esmf_utiliounitget

Called by

proc~~esmf_esmfinq~~CalledByGraph proc~esmf_esmfinq ESMF_EsmfInq proc~esmf_meshcreatefromunstruct ESMF_MeshCreateFromUnstruct proc~esmf_meshcreatefromunstruct->proc~esmf_esmfinq proc~esmf_meshcreatefromfileold ESMF_MeshCreateFromFileOld proc~esmf_meshcreatefromfileold->proc~esmf_meshcreatefromunstruct proc~esmf_meshcreatefromscrip ESMF_MeshCreateFromScrip proc~esmf_meshcreatefromfileold->proc~esmf_meshcreatefromscrip proc~esmf_meshcreatefromscrip->proc~esmf_meshcreatefromunstruct

Source Code

subroutine ESMF_EsmfInq(filename, nodeCount, elementCount, &
                        maxNodePElement, coordDim,  &
                        haveNodeMask, haveElmtMask, haveArea, &
                        haveOrigGridDims, origGridDims, rc)

! !ARGUMENTS:

    character(len=*), intent(in)   :: filename
    integer, intent(out), optional :: nodeCount
    integer, intent(out), optional :: elementCount
    integer, intent(out), optional :: maxNodePElement
    integer, intent(out), optional :: coordDim
    logical, intent(out), optional :: haveNodeMask
    logical, intent(out), optional :: haveElmtMask
    logical, intent(out), optional :: haveArea
    logical, intent(out), optional :: haveOrigGridDims
    integer, intent(out), optional :: origGridDims(2)
    integer, intent(out), optional :: rc

    integer:: localrc, ncStatus
    integer :: DimId, VarId
    integer :: ncid, local_rank
    character(len=256):: errmsg
    integer, parameter :: nf90_noerror = 0

#ifdef ESMF_NETCDF
    if (present(rc)) rc=ESMF_SUCCESS
    ncStatus = nf90_open (path=trim(filename), mode=nf90_nowrite, ncid=ncid)
    if (CDFCheckError (ncStatus, &
      ESMF_METHOD, &
      ESMF_SRCLINE, trim(filename), rc)) return

    ! get number of elements
    if (present(nodeCount)) then
      ncStatus = nf90_inq_dimid (ncid, "nodeCount", DimId)
      errmsg = "Dimension nodeCount in "//trim(filename)
      if (CDFCheckError (ncStatus, &
        ESMF_METHOD, &
        ESMF_SRCLINE,errmsg,&
        rc)) return

      ncStatus = nf90_inquire_dimension (ncid, DimId, len=nodeCount)
      if (CDFCheckError (ncStatus, &
        ESMF_METHOD, &
        ESMF_SRCLINE,errmsg,&
        rc)) return
    end if

    ! get number of elements
    if (present(elementCount)) then
      ncStatus = nf90_inq_dimid (ncid, "elementCount", DimId)
      errmsg = "Dimension elementCount in "//trim(filename)
      if (CDFCheckError (ncStatus, &
        ESMF_METHOD, &
        ESMF_SRCLINE,errmsg,&
        rc)) return

      ncStatus = nf90_inquire_dimension (ncid, DimId, len=elementCount)
      if (CDFCheckError (ncStatus, &
        ESMF_METHOD, &
        ESMF_SRCLINE,errmsg,&
        rc)) return
    end if

    ! get number of elements
    if (present(maxNodePElement)) then
      ncStatus = nf90_inq_dimid (ncid, "maxNodePElement", DimId)
      errmsg = "Dimension maxNodePElement in "//trim(filename)
      if (ncStatus /= nf90_noerror) then
         maxNodePElement = -1
      else
         ncStatus = nf90_inquire_dimension (ncid, DimId, len=maxNodePElement)
         if (CDFCheckError (ncStatus, &
           ESMF_METHOD, &
           ESMF_SRCLINE,errmsg,&
           rc)) return
      end if
    end if

    ! get number of elements
    if (present(coordDim)) then
      ncStatus = nf90_inq_dimid (ncid, "coordDim", DimId)
      errmsg = "Dimension coordDim in "//trim(filename)
      if (CDFCheckError (ncStatus, &
        ESMF_METHOD, &
        ESMF_SRCLINE,errmsg,&
        rc)) return

      ncStatus = nf90_inquire_dimension (ncid, DimId, len=coordDim)
      if (CDFCheckError (ncStatus, &
        ESMF_METHOD, &
        ESMF_SRCLINE,errmsg,&
        rc)) return
    end if

    ! check if elementMask exit
    if (present(haveElmtMask)) then
      ncStatus = nf90_inq_varid (ncid, "elementMask", VarId)
      if (ncStatus == nf90_noerror) then
           haveElmtMask = .true.
      else
           haveElmtMask = .false.
      end if
    end if

    ! check if nodeMask exit
    if (present(haveNodeMask)) then
      ncStatus = nf90_inq_varid (ncid, "nodeMask", VarId)
      if (ncStatus == nf90_noerror) then
           haveNodeMask = .true.
      else
           haveNodeMask = .false.
      end if
    end if

    ! check if elementArea exit
    if (present(haveArea)) then
      ncStatus = nf90_inq_varid (ncid, "elementArea", VarId)
      if (ncStatus == nf90_noerror) then
           haveArea = .true.
      else
           haveArea = .false.
      end if
    end if

    ! check if haveOrigGridDims
    if (present(haveOrigGridDims)) then
      ncStatus = nf90_inq_varid (ncid, "origGridDims", VarId)
      if (ncStatus == nf90_noerror) then
           haveOrigGridDims = .true.
      else
           haveOrigGridDims = .false.
      end if
    end if

! XMRKX !
    ! Get origGridDims
    if (present(origGridDims)) then
      ncStatus = nf90_inq_varid (ncid, "origGridDims", VarId)
      errmsg = "Variable origGridDims in "//trim(filename)
      if (CDFCheckError (ncStatus, &
        ESMF_METHOD, &
        ESMF_SRCLINE,errmsg,&
        rc)) return

      ncStatus=nf90_get_var(ncid, VarId, origGridDims)
      if (CDFCheckError (ncStatus, &
           ESMF_METHOD, &
           ESMF_SRCLINE,errmsg,&
           rc)) return
    end if

    if (present(rc)) rc=ESMF_SUCCESS
    return
#else
    if (ESMF_LogFoundError(ESMF_RC_LIB_NOT_PRESENT, &
                msg="- ESMF_NETCDF not defined when lib was compiled", &
                ESMF_CONTEXT, rcToReturn=rc)) return
#endif

end subroutine ESMF_EsmfInq