subroutine f_esmf_gridcreatefromfile(gridp, filename, fileTypeFlag, &
regDecomp, decompflag, isSphere, polekindflag, len1, addCornerStagger, &
addUserArea, indexflag, addMask, varname, coordNames, rc)
use ESMF_UtilTypesMod
use ESMF_LogErrMod
use ESMF_GridMod
use ESMF_DistGridMod
use ESMF_VMMod
implicit none
! arguments
type(ESMF_Pointer) :: gridp
character(len=*), intent(in) :: filename
type(ESMF_FileFormat_Flag), optional :: fileTypeFlag
integer, optional :: regDecomp(2)
type(ESMF_Decomp_Flag), optional :: decompflag(2)
logical, optional :: isSphere
integer :: len1
type(ESMF_PoleKind_Flag), optional :: polekindflag(1:len1)
logical, optional :: addCornerStagger
logical, optional :: addUserArea
type(ESMF_Index_Flag), optional :: indexflag
logical, optional :: addMask
character(len=*), optional :: varname
character(len=*), optional :: coordNames(2)
integer, intent(out), optional :: rc
type(ESMF_Grid) :: grid
logical :: isSphere_loc
logical :: addCornerStagger_loc
logical :: addUserArea_loc
logical :: addMask_loc
!print '("Start ESMF_Grid_C.F90 : f_esmf_gridcreatefromfile(",A,", ",I1,"])")', filename, fileTypeFlag
! initialize return code; assume routine not implemented
rc = ESMF_RC_NOT_IMPL
! Set reasonable defaults for optional arguments
isSphere_loc = .true.
if(present(isSphere)) then
isSphere_loc = isSphere
endif
addCornerStagger_loc = .false.
if(present(addCornerStagger)) then
addCornerStagger_loc = addCornerStagger
endif
addUserArea_loc = .false.
if(present(addUserArea)) then
addUserArea_loc = addUserArea
endif
addMask_loc = .false.
if(present(addMask)) then
addMask_loc = addMask
endif
grid = ESMF_GridCreate(filename, fileTypeFlag, &
regDecomp=regDecomp, &
decompflag=decompflag, &
isSphere=isSphere_loc, &
polekindflag=polekindflag, &
addCornerStagger=addCornerStagger_loc, &
addUserArea=addUserArea_loc, &
indexflag=indexflag, &
addMask=addMask_loc, &
varname=varname, &
coordNames=coordNames, &
rc=rc)
if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
gridp = grid%this
rc = ESMF_SUCCESS
!print '("End ESMF_Grid_C.F90 : f_esmf_gridcreatefromfile()")'
end subroutine f_esmf_gridcreatefromfile