f_esmf_localarrayctof90 Subroutine

subroutine f_esmf_localarrayctof90(arrayPtr, cptr, rank, typekind, counts, lbounds, ubounds, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Pointer) :: arrayPtr
type(C_PTR) :: cptr
integer :: rank
type(ESMF_TypeKind_Flag) :: typekind
integer :: counts(rank)
integer :: lbounds(rank)
integer :: ubounds(rank)
integer :: rc

Source Code

subroutine f_esmf_localarrayctof90(arrayPtr, cptr, rank, typekind, counts, &
  lbounds, ubounds, rc)
  use ESMF_UtilTypesMod     ! ESMF base class
  use ESMF_BaseMod          ! ESMF base class
  use ESMF_LogErrMod        ! ESMF error logging
  use ESMF_LocalArrayMod
  use ISO_C_BINDING
  
  implicit none

  type(ESMF_Pointer)        :: arrayPtr
  type(C_PTR)               :: cptr
  integer                   :: rank
  type(ESMF_TypeKind_Flag)  :: typekind
  integer                   :: counts(rank)
  integer                   :: lbounds(rank)
  integer                   :: ubounds(rank)
  integer                   :: rc

  type(ESMF_LocalArray)     :: array

  array%this = arrayPtr
  ESMF_INIT_SET_CREATED(array)

  ! Beware - these args are not in the same order
  call ESMF_LocalArrCToF90Ptr(array, cptr, counts, typekind, rank, &
    lbounds, ubounds, rc=rc)
  if (ESMF_LogFoundError(rcToCheck=rc, &
    ESMF_ERR_PASSTHRU, &
    ESMF_CONTEXT)) return

end subroutine f_esmf_localarrayctof90