Skip to content

Commit

Permalink
Add vm arguemnts to Get() methods in support of StateReconcile()
Browse files Browse the repository at this point in the history
optimization work.
  • Loading branch information
theurich committed Sep 24, 2024
1 parent 95349b6 commit 207f323
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 8 deletions.
19 changes: 16 additions & 3 deletions src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ module ESMF_ArrayBundleMod
use ESMF_IOUtilMod
use ESMF_RHandleMod
use ESMF_ArrayMod

use ESMF_VMMod

implicit none

!------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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}
!
Expand All @@ -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}
Expand Down Expand Up @@ -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

Expand Down
17 changes: 14 additions & 3 deletions src/Infrastructure/FieldBundle/src/ESMF_FieldBundle.cppF90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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}
!
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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

Expand Down
12 changes: 11 additions & 1 deletion src/Infrastructure/Route/interface/ESMF_RHandle.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

!
Expand All @@ -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}
Expand All @@ -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

Expand Down
13 changes: 12 additions & 1 deletion src/Superstructure/State/src/ESMF_StateAPI.cppF90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

!
Expand All @@ -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}
!
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 207f323

Please sign in to comment.