Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CPP ESMF_VERSION_MAJOR and ESMF_VERSION_MINOR definitions. #99

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mediator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ ifdef INTERNAL_PIO_INIT
CPPDEFS := -DINTERNAL_PIO_INIT
endif

ESMF_VERSION_MAJOR ?= 0
ESMF_VERSION_MINOR ?= 0
CPPDEFS += -DESMF_VERSION_MAJOR=$(ESMF_VERSION_MAJOR)
CPPDEFS += -DESMF_VERSION_MINOR=$(ESMF_VERSION_MINOR)

LIBRARY := libcmeps.a

OBJ = $(patsubst %.F90, %.o, $(wildcard *.F90))
Expand Down
21 changes: 12 additions & 9 deletions mediator/esmFlds.F90
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,11 @@ subroutine med_fldList_Realize(state, fldList, flds_scalar_name, flds_scalar_num
use ESMF , only : ESMF_StateGet, ESMF_LogFoundError
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_ERROR, ESMF_FAILURE, ESMF_LOGERR_PASSTHRU
use ESMF , only : ESMF_LOGMSG_INFO, ESMF_StateRemove, ESMF_SUCCESS
#if ESMF_VERSION_MINOR > 0
#if ESMF_VERSION_MAJOR >= 8
#if ESMF_VERSION_MINOR > 0
use ESMF , only : ESMF_STATEINTENT_IMPORT, ESMF_STATEINTENT_EXPORT, ESMF_StateIntent_Flag
use ESMF , only : ESMF_RC_ARG_BAD, ESMF_LogSetError, operator(==)
#endif
#endif
! input/output variables
type(ESMF_State) , intent(inout) :: state
Expand All @@ -378,9 +380,11 @@ subroutine med_fldList_Realize(state, fldList, flds_scalar_name, flds_scalar_num
type(ESMF_Field) :: field
character(CS) :: shortname
character(CS) :: stdname
#if ESMF_VERSION_MINOR > 0
type(ESMF_StateIntent_Flag) :: stateIntent
character(ESMF_MAXSTR) :: transferActionAttr
#if ESMF_VERSION_MAJOR >= 8
#if ESMF_VERSION_MINOR > 0
type(ESMF_StateIntent_Flag) :: stateIntent
#endif
#endif
character(ESMF_MAXSTR) :: transferAction
character(ESMF_MAXSTR), pointer :: StandardNameList(:)
Expand Down Expand Up @@ -445,7 +449,9 @@ subroutine med_fldList_Realize(state, fldList, flds_scalar_name, flds_scalar_num
#endif

nflds = size(fldList%flds)
#if ESMF_VERSION_MINOR > 0
transferActionAttr="TransferActionGeomObject"
#if ESMF_VERSION_MAJOR >= 8
#if ESMF_VERSION_MINOR > 0
call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc)
if (stateIntent==ESMF_STATEINTENT_EXPORT) then
transferActionAttr="ProducerTransferAction"
Expand All @@ -459,6 +465,7 @@ subroutine med_fldList_Realize(state, fldList, flds_scalar_name, flds_scalar_num
rcToReturn=rc)
return ! bail out
endif
#endif
#endif

do n = 1, nflds
Expand All @@ -469,12 +476,8 @@ subroutine med_fldList_Realize(state, fldList, flds_scalar_name, flds_scalar_num

call ESMF_StateGet(state, field=field, itemName=trim(shortname), rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return
#if ESMF_VERSION_MINOR > 0
call NUOPC_GetAttribute(field, name=TransferActionAttr, value=transferAction, rc=rc)
#else
call NUOPC_GetAttribute(field, name="TransferActionGeomObject", value=transferAction, rc=rc)
#endif

call NUOPC_GetAttribute(field, name=TransferActionAttr, value=transferAction, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return

if (trim(transferAction) == "accept") then ! accept
Expand Down
12 changes: 9 additions & 3 deletions mediator/med.F90
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,11 @@ subroutine InitializeIPDv03p3(gcomp, importState, exportState, clock, rc)
use ESMF , only : ESMF_GridComp, ESMF_State, ESMF_Clock, ESMF_VM, ESMF_SUCCESS
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_TimeInterval
use ESMF , only : ESMF_VMGet, ESMF_StateIsCreated, ESMF_GridCompGet
#if ESMF_VERSION_MINOR > 0
#if ESMF_VERSION_MAJOR >= 8
#if ESMF_VERSION_MINOR > 0
use ESMF , only : ESMF_StateSet, ESMF_StateIntent_Import, ESMF_StateIntent_Export
use ESMF , only : ESMF_StateIntent_Flag
#endif
#endif
! Input/output variables
type(ESMF_GridComp) :: gcomp
Expand Down Expand Up @@ -775,19 +777,23 @@ subroutine InitializeIPDv03p3(gcomp, importState, exportState, clock, rc)
! Realize States
do n = 1,ncomps
if (ESMF_StateIsCreated(is_local%wrap%NStateImp(n), rc=rc)) then
#if ESMF_VERSION_MINOR > 0
#if ESMF_VERSION_MAJOR >= 8
#if ESMF_VERSION_MINOR > 0
call ESMF_StateSet(is_local%wrap%NStateImp(n), stateIntent=ESMF_StateIntent_Import, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
#endif
#endif
call med_fldList_Realize(is_local%wrap%NStateImp(n), fldListFr(n), &
is_local%wrap%flds_scalar_name, is_local%wrap%flds_scalar_num, &
tag=subname//':Fr_'//trim(compname(n)), rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif
if (ESMF_StateIsCreated(is_local%wrap%NStateExp(n), rc=rc)) then
#if ESMF_VERSION_MINOR > 0
#if ESMF_VERSION_MAJOR >= 8
#if ESMF_VERSION_MINOR > 0
call ESMF_StateSet(is_local%wrap%NStateExp(n), stateIntent=ESMF_StateIntent_Export, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
#endif
#endif
call med_fldList_Realize(is_local%wrap%NStateExp(n), fldListTo(n), &
is_local%wrap%flds_scalar_name, is_local%wrap%flds_scalar_num, &
Expand Down