Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ESMF_Pointer) | :: | arrayInPtr | ||||
type(ESMF_Pointer) | :: | arrayOutPtr | ||||
type(ESMF_DataCopy_Flag) | :: | datacopyflag | ||||
integer | :: | rc |
subroutine f_esmf_localarraycopyf90ptr(arrayInPtr, arrayOutPtr, datacopyflag, rc) use ESMF_UtilTypesMod ! ESMF base class use ESMF_BaseMod ! ESMF base class use ESMF_LogErrMod ! ESMF error logging use ESMF_LocalArrayMod implicit none type(ESMF_Pointer) :: arrayInPtr type(ESMF_Pointer) :: arrayOutPtr type(ESMF_DataCopy_Flag) :: datacopyflag integer :: rc type(ESMF_LocalArray) :: arrayIn type(ESMF_LocalArray) :: arrayOut ! Very important: the pointers passed from C and used as references for ! arrayInArg and arrayOutArg are simple pointers to pointers from the C side. ! This means that there is no memory for what the F90 INITMACROS are using ! at that location! In order to deal with this C<->F90 difference local ! F90 variables are necessary to work on the F90 side and this glue code will ! copy the "this" member in the derived type which is the part that actually ! needs to be passed between C and F90. arrayIn%this = arrayInPtr ESMF_INIT_SET_CREATED(arrayIn) arrayOut%this = arrayOutPtr ! do the actual copy, allocating the required memory call ESMF_LocalArrayCopyF90Ptr(arrayIn, arrayOut, datacopyflag=datacopyflag, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, & ESMF_ERR_PASSTHRU, & ESMF_CONTEXT)) return end subroutine f_esmf_localarraycopyf90ptr