From 207f3234c0c7c1027afb217646cbf08246e31883 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 24 Sep 2024 12:06:48 -0600 Subject: [PATCH] Add `vm` arguemnts to Get() methods in support of StateReconcile() optimization work. --- .../interface/ESMF_ArrayBundle.F90 | 19 ++++++++++++++++--- .../FieldBundle/src/ESMF_FieldBundle.cppF90 | 17 ++++++++++++++--- .../Route/interface/ESMF_RHandle.F90 | 12 +++++++++++- .../State/src/ESMF_StateAPI.cppF90 | 13 ++++++++++++- 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90 b/src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90 index adfd393b05..c6a4594ee9 100644 --- a/src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90 +++ b/src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90 @@ -44,7 +44,8 @@ module ESMF_ArrayBundleMod use ESMF_IOUtilMod use ESMF_RHandleMod use ESMF_ArrayMod - + use ESMF_VMMod + implicit none !------------------------------------------------------------------------------ @@ -883,9 +884,9 @@ end subroutine ESMF_ArrayBundleDestroy ! !IROUTINE: ESMF_ArrayBundleGet - Get object-wide information from an ArrayBundle ! ! !INTERFACE: - ! Private name; call using ESMF_ArrayBundleGet() + ! Private name; call using ESMF_ArrayBundleGet() subroutine ESMF_ArrayBundleGetListAll(arraybundle, keywordEnforcer, & - itemorderflag, arrayCount, arrayList, arrayNameList, name, rc) + itemorderflag, arrayCount, arrayList, arrayNameList, name, vm, rc) ! ! !ARGUMENTS: type(ESMF_ArrayBundle), intent(in) :: arraybundle @@ -895,6 +896,7 @@ subroutine ESMF_ArrayBundleGetListAll(arraybundle, keywordEnforcer, & type(ESMF_Array), intent(out), optional :: arrayList(:) character(len=*), intent(out), optional :: arrayNameList(:) character(len=*), intent(out), optional :: name + type(ESMF_VM), intent(out), optional :: vm integer, intent(out), optional :: rc ! ! !STATUS: @@ -905,6 +907,8 @@ subroutine ESMF_ArrayBundleGetListAll(arraybundle, keywordEnforcer, & ! \item[6.1.0] Added argument {\tt itemorderflag}. ! The new argument gives the user control over the order in which ! the items are returned. +! \item[8.8.0] Added argument {\tt vm} in order to offer information about the +! VM on which the ArrayBundle was created. ! \end{description} ! \end{itemize} ! @@ -930,6 +934,8 @@ subroutine ESMF_ArrayBundleGetListAll(arraybundle, keywordEnforcer, & ! size {\tt arrayCount}. ! \item [{[name]}] ! Name of the ArrayBundle object. +! \item [{[vm}] +! The VM on which the ArrayBundle object was created. ! \item [{[rc]}] ! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors. ! \end{description} @@ -1015,6 +1021,13 @@ subroutine ESMF_ArrayBundleGetListAll(arraybundle, keywordEnforcer, & endif endif + ! Special call to get vm out of Base class + if (present(vm)) then + call c_ESMC_GetVM(arraybundle, vm, localrc) + if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & + ESMF_CONTEXT, rcToReturn=rc)) return + endif + ! Return successfully if (present(rc)) rc = ESMF_SUCCESS diff --git a/src/Infrastructure/FieldBundle/src/ESMF_FieldBundle.cppF90 b/src/Infrastructure/FieldBundle/src/ESMF_FieldBundle.cppF90 index e160fae06a..e48f8d8653 100644 --- a/src/Infrastructure/FieldBundle/src/ESMF_FieldBundle.cppF90 +++ b/src/Infrastructure/FieldBundle/src/ESMF_FieldBundle.cppF90 @@ -1705,7 +1705,7 @@ type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below ! Private name; call using ESMF_FieldBundleGet() subroutine ESMF_FieldBundleGetListAll(fieldbundle, keywordEnforcer, & itemorderflag, geomtype, grid, locstream, mesh, xgrid, & - fieldCount, fieldList, fieldNameList, isPacked, name, rc) + fieldCount, fieldList, fieldNameList, isPacked, name, vm, rc) ! ! !ARGUMENTS: type(ESMF_FieldBundle), intent(in) :: fieldbundle @@ -1721,6 +1721,7 @@ type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below character(len=*), intent(out), optional :: fieldNameList(:) logical, intent(out), optional :: isPacked character(len=*), intent(out), optional :: name + type(ESMF_VM), intent(out), optional :: vm integer, intent(out), optional :: rc ! ! !STATUS: @@ -1733,6 +1734,8 @@ type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below ! the items are returned. ! \item[8.0.0] Added argument {\tt isPacked}. ! The new argument allows the user to query if this is a packed FieldBundle. +! \item[8.8.0] Added argument {\tt vm} in order to offer information about the +! VM on which the FieldBundle was created. ! \end{description} ! \end{itemize} ! @@ -1771,7 +1774,9 @@ type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below ! \item [{[isPacked]}] ! Upon return holds the information if this FieldBundle is packed. ! \item [{[name]}] -! Name of the fieldbundle object. +! Name of the FieldBundle object. +! \item [{[vm}] +! The VM on which the FieldBundle object was created. ! \item [{[rc]}] ! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors. ! \end{description} @@ -1960,7 +1965,13 @@ type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below ESMF_CONTEXT, rcToReturn=rc)) return endif endif - + + if (present(vm)) then + call c_ESMC_GetVM(fieldbundle%this%base, vm, localrc) + if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & + ESMF_CONTEXT, rcToReturn=rc)) return + endif + ! Return successfully if (present(rc)) rc = ESMF_SUCCESS diff --git a/src/Infrastructure/Route/interface/ESMF_RHandle.F90 b/src/Infrastructure/Route/interface/ESMF_RHandle.F90 index 7e5dcf2779..b0d57b3a6f 100644 --- a/src/Infrastructure/Route/interface/ESMF_RHandle.F90 +++ b/src/Infrastructure/Route/interface/ESMF_RHandle.F90 @@ -43,6 +43,7 @@ module ESMF_RHandleMod use ESMF_LogErrMod ! ESMF error handling use ESMF_F90InterfaceMod ! ESMF F90-C++ interface helper use ESMF_IOUtilMod ! ESMF I/O utility layer + use ESMF_VMMod implicit none @@ -755,12 +756,13 @@ end subroutine ESMF_RouteHandleDestroy ! !INTERFACE: ! Private name; call using ESMF_RouteHandleGet() - subroutine ESMF_RouteHandleGetP(routehandle, keywordEnforcer, name, rc) + subroutine ESMF_RouteHandleGetP(routehandle, keywordEnforcer, name, vm, rc) ! ! !ARGUMENTS: type(ESMF_RouteHandle), intent(in) :: routehandle type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below character(len=*), intent(out), optional :: name + type(ESMF_VM), intent(out), optional :: vm integer, intent(out), optional :: rc ! @@ -773,6 +775,8 @@ subroutine ESMF_RouteHandleGetP(routehandle, keywordEnforcer, name, rc) ! {\tt ESMF\_RouteHandle} to be queried. ! \item [{[name]}] ! Name of the RouteHandle object. +! \item [{[vm}] +! The VM on which the RouteHandle object was created. ! \item[{[rc]}] ! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors. ! \end{description} @@ -794,6 +798,12 @@ subroutine ESMF_RouteHandleGetP(routehandle, keywordEnforcer, name, rc) ESMF_CONTEXT, rcToReturn=rc)) return endif + if (present(vm)) then + call c_ESMC_GetVM(routehandle, vm, localrc) + if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & + ESMF_CONTEXT, rcToReturn=rc)) return + endif + ! Return successfully if (present(rc)) rc = ESMF_SUCCESS diff --git a/src/Superstructure/State/src/ESMF_StateAPI.cppF90 b/src/Superstructure/State/src/ESMF_StateAPI.cppF90 index 0e26f6e7de..20371d2cdb 100644 --- a/src/Superstructure/State/src/ESMF_StateAPI.cppF90 +++ b/src/Superstructure/State/src/ESMF_StateAPI.cppF90 @@ -1123,7 +1123,7 @@ ESMF_INIT_CHECK_DEEP(ESMF_RouteHandleGetInit,routehandleList(i),rc) ! Private name; call using ESMF_StateGet() subroutine ESMF_StateGetInfo(state, & keywordEnforcer, itemSearch, itemorderflag, nestedFlag, & - stateIntent, itemCount, itemNameList, itemTypeList, name, rc) + stateIntent, itemCount, itemNameList, itemTypeList, name, vm, rc) ! ! !ARGUMENTS: type(ESMF_State), intent(in) :: state @@ -1136,6 +1136,7 @@ ESMF_INIT_CHECK_DEEP(ESMF_RouteHandleGetInit,routehandleList(i),rc) character (len=*), intent(out), optional :: itemNameList(:) type(ESMF_StateItem_Flag), intent(out), optional :: itemTypeList(:) character (len=*), intent(out), optional :: name + type(ESMF_VM), intent(out), optional :: vm integer, intent(out), optional :: rc ! @@ -1147,6 +1148,8 @@ ESMF_INIT_CHECK_DEEP(ESMF_RouteHandleGetInit,routehandleList(i),rc) ! \item[6.1.0] Added argument {\tt itemorderflag}. ! The new argument gives the user control over the order in which ! the items are returned. +! \item[8.8.0] Added argument {\tt vm} in order to offer information about the +! VM on which the State was created. ! \end{description} ! \end{itemize} ! @@ -1205,6 +1208,8 @@ ESMF_INIT_CHECK_DEEP(ESMF_RouteHandleGetInit,routehandleList(i),rc) ! long. Return values are listed in Section~\ref{const:stateitem}. ! \item[{[name]}] ! Returns the name of this {\tt ESMF\_State}. +! \item [{[vm}] +! The VM on which the State object was created. ! \item[{[rc]}] ! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors. ! \end{description} @@ -1268,6 +1273,12 @@ ESMF_INIT_CHECK_DEEP(ESMF_RouteHandleGetInit,routehandleList(i),rc) call itemTypeWorker (stypep) endif + if (present(vm)) then + call c_ESMC_GetVM(stypep%base, vm, localrc) + if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & + ESMF_CONTEXT, rcToReturn=rc)) return + endif + ! return successfully if (present(rc)) rc = ESMF_SUCCESS