subroutine f_esmf_fieldcreatemeshtk(field, mesh_pointer, typekind, meshloc, &
gridToFieldMap, len1, gtfmpresent, &
ungriddedLBound, len2, uglbpresent, &
ungriddedUBound, len3, ugubpresent, name, rc)
use ESMF_UtilTypesMod
use ESMF_BaseMod
use ESMF_LogErrMod
use ESMF_MeshMod
use ESMF_FieldMod
use ESMF_FieldCreateMod
implicit none
! arguments
type(ESMF_Field) :: field
type(ESMF_Pointer) :: mesh_pointer
type(ESMF_TypeKind_Flag) :: typekind
type(ESMF_MeshLoc) :: meshloc
integer, intent(in) :: len1, len2, len3
integer, intent(in) :: gtfmpresent, uglbpresent, ugubpresent
integer :: gridToFieldMap(1:len1), &
ungriddedLBound(1:len2), &
ungriddedUBound(1:len3)
character(len=*),intent(in) :: name
integer, intent(out) :: rc
! local variables
type(ESMF_Mesh) :: mesh
! initialize return code; assume routine not implemented
rc = ESMF_RC_NOT_IMPL
! mesh%this = mesh_pointer
mesh = ESMF_MeshCreateFromIntPtr(mesh_pointer)
if (gtfmpresent == 0 .and. uglbpresent == 0 .and. ugubpresent == 0) then
field = ESMF_FieldCreate(mesh, typekind=typekind, meshloc=meshloc, &
name=name, rc=rc)
else if (gtfmpresent == 1 .and. uglbpresent == 0 .and. ugubpresent == 0) then
field = ESMF_FieldCreate(mesh, typekind=typekind, meshloc=meshloc, &
gridToFieldMap=gridToFieldMap, &
name=name, rc=rc)
else if (gtfmpresent == 0 .and. uglbpresent == 1 .and. ugubpresent == 0) then
field = ESMF_FieldCreate(mesh, typekind=typekind, meshloc=meshloc, &
ungriddedLBound=ungriddedLBound, &
name=name, rc=rc)
else if (gtfmpresent == 0 .and. uglbpresent == 0 .and. ugubpresent == 1) then
field = ESMF_FieldCreate(mesh, typekind=typekind, meshloc=meshloc, &
ungriddedUBound=ungriddedUBound, &
name=name, rc=rc)
else if (gtfmpresent == 1 .and. uglbpresent == 1 .and. ugubpresent == 0) then
field = ESMF_FieldCreate(mesh, typekind=typekind, meshloc=meshloc, &
gridToFieldMap=gridToFieldMap, &
ungriddedLBound=ungriddedLBound, &
name=name, rc=rc)
else if (gtfmpresent == 0 .and. uglbpresent == 1 .and. ugubpresent == 1) then
field = ESMF_FieldCreate(mesh, typekind=typekind, meshloc=meshloc, &
ungriddedLBound=ungriddedLBound, &
ungriddedUBound=ungriddedUBound, &
name=name, rc=rc)
else if (gtfmpresent == 1 .and. uglbpresent == 0 .and. ugubpresent == 1) then
field = ESMF_FieldCreate(mesh, typekind=typekind, meshloc=meshloc, &
gridToFieldMap=gridToFieldMap, &
ungriddedUBound=ungriddedUBound, &
name=name, rc=rc)
else if (gtfmpresent == 1 .and. uglbpresent == 1 .and. ugubpresent == 1) then
field = ESMF_FieldCreate(mesh, typekind=typekind, meshloc=meshloc, &
gridToFieldMap=gridToFieldMap, &
ungriddedLBound=ungriddedLBound, &
ungriddedUBound=ungriddedUBound, &
name=name, rc=rc)
endif
if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
rc = ESMF_SUCCESS
end subroutine f_esmf_fieldcreatemeshtk