Skip to content

Commit

Permalink
Merge pull request #61 from GEOS-ESM/hotfix/esherman/cvs-to-git-updates2
Browse files Browse the repository at this point in the history
Hotfix/esherman/cvs to git updates2
  • Loading branch information
bena-nasa authored Sep 27, 2019
2 parents e32f2e7 + fba1126 commit 4a0fb2d
Showing 1 changed file with 88 additions and 19 deletions.
107 changes: 88 additions & 19 deletions MAPL_Base/MAPL_Generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6726,13 +6726,14 @@ end subroutine MAPL_CopyFriendlinessInField

!....................................................................................

subroutine MAPL_GridCompGetFriendlies0 ( GC, TO, BUNDLE, RC )
subroutine MAPL_GridCompGetFriendlies0 ( GC, TO, BUNDLE, AddGCPrefix, RC )

! !ARGUMENTS:

type(ESMF_GridComp), intent(INOUT) :: GC
character(len=*), intent(IN ) :: TO(:)
type(ESMF_FieldBundle ), intent(INOUT) :: BUNDLE
logical, optional, intent(IN ) :: AddGCPrefix
integer, optional, intent( OUT) :: RC

!=============================================================================
Expand All @@ -6747,7 +6748,7 @@ subroutine MAPL_GridCompGetFriendlies0 ( GC, TO, BUNDLE, RC )

type (MAPL_MetaComp), pointer :: STATE
type (ESMF_State) :: INTERNAL
type (ESMF_Field) :: FIELD
type (ESMF_Field) :: FIELD, TempField
character (len=ESMF_MAXSTR), allocatable :: itemNameList(:)
type(ESMF_StateItem_Flag), allocatable :: itemtypeList(:)
type(ESMF_FieldBundle) :: B
Expand All @@ -6760,9 +6761,17 @@ subroutine MAPL_GridCompGetFriendlies0 ( GC, TO, BUNDLE, RC )
character(len=ESMF_MAXSTR), allocatable :: currList(:)
integer :: natt

logical :: AddPrefix_
character(len=ESMF_MAXSTR) :: GC_NAME, fieldname

! Get my MAPL_Generic state
!--------------------------

AddPrefix_ = .false.
if (present(AddGCPrefix) ) then
AddPrefix_ = AddGCPrefix
end if

call MAPL_InternalStateGet ( GC, STATE, RC=STATUS)
VERIFY_(STATUS)

Expand Down Expand Up @@ -6817,8 +6826,22 @@ subroutine MAPL_GridCompGetFriendlies0 ( GC, TO, BUNDLE, RC )
VERIFY_(STATUS)
call Am_I_Friendly_ ( FIELD, TO, RC=STATUS )
if(STATUS==ESMF_SUCCESS) then
call MAPL_FieldBundleAdd(BUNDLE, FIELD, RC=STATUS )
VERIFY_(STATUS)
if (AddPrefix_) then
call ESMF_GridCompGet(GC, NAME=GC_NAME, RC=status)
VERIFY_(STATUS)
if (scan(itemNameList(I),"::")==0) then
TempField = MAPL_FieldCreate(FIELD, name=(trim(GC_NAME)//'::'//trim(itemNameList(I))), RC=STATUS)
VERIFY_(STATUS)
call MAPL_FieldBundleAdd(BUNDLE, TempField, RC=STATUS)
VERIFY_(STATUS)
else
call MAPL_FieldBundleAdd(BUNDLE, FIELD, RC=STATUS )
VERIFY_(STATUS)
end if
else
call MAPL_FieldBundleAdd(BUNDLE, FIELD, RC=STATUS )
VERIFY_(STATUS)
end if ! (AddPrefix_)
end if
else if(itemtypeList(I)==ESMF_STATEITEM_FieldBundle) then
call ESMF_StateGet(INTERNAL,itemNameList(I), B, RC=STATUS)
Expand All @@ -6829,21 +6852,64 @@ subroutine MAPL_GridCompGetFriendlies0 ( GC, TO, BUNDLE, RC )
if(STATUS==ESMF_SUCCESS) then
! if the bundle is "friendly", copy every single field
DO J=1,NF
call MAPL_FieldBundleGet(B, J, FIELD, RC=STATUS)
VERIFY_(STATUS)
call MAPL_FieldBundleAdd (BUNDLE, FIELD, RC=STATUS )
VERIFY_(STATUS)
if (AddPrefix_) then
call ESMF_GridCompGet(GC, NAME=GC_NAME, RC=status)
VERIFY_(STATUS)
call MAPL_FieldBundleGet(B, J, FIELD, RC=STATUS)
VERIFY_(STATUS)
call ESMF_FieldGet (FIELD, name=fieldname, RC=STATUS)
VERIFY_(STATUS)
if (scan(fieldname,"::")==0) then
TempField = MAPL_FieldCreate(FIELD, name=(trim(GC_NAME)//'::'//trim(fieldname)), RC=STATUS)
VERIFY_(STATUS)
call MAPL_FieldBundleAdd(BUNDLE, TempField, RC=STATUS)
VERIFY_(STATUS)
else
call MAPL_FieldBundleGet(B, J, FIELD, RC=STATUS)
VERIFY_(STATUS)
call MAPL_FieldBundleAdd(BUNDLE, FIELD, RC=STATUS )
VERIFY_(STATUS)
end if
else
call MAPL_FieldBundleGet(B, J, FIELD, RC=STATUS)
VERIFY_(STATUS)
call MAPL_FieldBundleAdd (BUNDLE, FIELD, RC=STATUS )
VERIFY_(STATUS)
end if ! (AddPrefix_)
END DO
else
! check the fields for "friendliness"
DO J=1,NF
call MAPL_FieldBundleGet(B, J, FIELD, RC=STATUS)
VERIFY_(STATUS)
call Am_I_Friendly_ ( FIELD, TO, RC=STATUS )
if(STATUS==ESMF_SUCCESS) then
if (AddPrefix_) then
call ESMF_GridCompGet(GC, NAME=GC_NAME, RC=status)
VERIFY_(STATUS)
call MAPL_FieldBundleGet(B, J, FIELD, RC=STATUS)
VERIFY_(STATUS)
call ESMF_FieldGet (FIELD, name=fieldname, RC=STATUS)
VERIFY_(STATUS)
if (scan(fieldname,"::")==0) then
TempField = MAPL_FieldCreate(FIELD, name=(trim(GC_NAME)//'::'//trim(fieldname)), RC=STATUS)
VERIFY_(STATUS)
call MAPL_FieldBundleAdd(BUNDLE, TempField, RC=STATUS)
VERIFY_(STATUS)
else
call MAPL_FieldBundleGet(B, J, FIELD, RC=STATUS)
VERIFY_(STATUS)
call Am_I_Friendly_ ( FIELD, TO, RC=STATUS )
if(STATUS==ESMF_SUCCESS) then
call MAPL_FieldBundleAdd (BUNDLE, FIELD, RC=STATUS )
VERIFY_(STATUS)
end if
end if
else
call MAPL_FieldBundleGet(B, J, FIELD, RC=STATUS)
VERIFY_(STATUS)
call Am_I_Friendly_ ( FIELD, TO, RC=STATUS )
if(STATUS==ESMF_SUCCESS) then
call MAPL_FieldBundleAdd (BUNDLE, FIELD, RC=STATUS )
VERIFY_(STATUS)
END if
END if
end if ! (AddPrefix_)
END DO
end if
end if
Expand Down Expand Up @@ -6896,13 +6962,14 @@ subroutine Am_I_Friendly__ ( BUNDLE, TO, RC )
end subroutine Am_I_Friendly__


subroutine MAPL_GridCompGetFriendlies1 ( GC, TO, BUNDLE, RC )
subroutine MAPL_GridCompGetFriendlies1 ( GC, TO, BUNDLE, AddGCPrefix, RC )

! !ARGUMENTS:

type(ESMF_GridComp), intent(INOUT) :: GC
character(len=*), intent(IN ) :: TO
type(ESMF_FieldBundle ), intent(INOUT) :: BUNDLE
logical, optional, intent(IN ) :: AddGCPrefix
integer, optional, intent( OUT) :: RC

!=============================================================================
Expand All @@ -6913,17 +6980,18 @@ subroutine MAPL_GridCompGetFriendlies1 ( GC, TO, BUNDLE, RC )
character(len=ESMF_MAXSTR) :: TO_(1)

TO_(1) = TO
call MAPL_GridCompGetFriendlies0 ( GC, TO_, BUNDLE, RC )
call MAPL_GridCompGetFriendlies0 ( GC, TO_, BUNDLE, AddGCPrefix, RC )

end subroutine MAPL_GridCompGetFriendlies1

subroutine MAPL_GridCompGetFriendlies2 ( GC, TO, BUNDLE, RC )
subroutine MAPL_GridCompGetFriendlies2 ( GC, TO, BUNDLE, AddGCPrefix, RC )

! !ARGUMENTS:

type(ESMF_GridComp), intent(INOUT) :: GC(:)
character(len=*), intent(IN ) :: TO
type(ESMF_FieldBundle ), intent(INOUT) :: BUNDLE
logical, optional, intent(IN ) :: AddGCPrefix
integer, optional, intent( OUT) :: RC

!=============================================================================
Expand All @@ -6936,20 +7004,21 @@ subroutine MAPL_GridCompGetFriendlies2 ( GC, TO, BUNDLE, RC )

TO_(1) = TO
do I=1,size(GC)
call MAPL_GridCompGetFriendlies0(GC(I), TO_, BUNDLE, RC=STATUS)
call MAPL_GridCompGetFriendlies0(GC(I), TO_, BUNDLE, AddGCPrefix, RC=STATUS)
VERIFY_(STATUS)
end do

RETURN_(ESMF_SUCCESS)
end subroutine MAPL_GridCompGetFriendlies2

subroutine MAPL_GridCompGetFriendlies3 ( GC, TO, BUNDLE, RC )
subroutine MAPL_GridCompGetFriendlies3 ( GC, TO, BUNDLE, AddGCPrefix, RC )

! !ARGUMENTS:

type(ESMF_GridComp), intent(INOUT) :: GC(:)
character(len=*), intent(IN ) :: TO(:)
type(ESMF_FieldBundle ), intent(INOUT) :: BUNDLE
logical, optional, intent(IN ) :: AddGCPrefix
integer, optional, intent( OUT) :: RC

!=============================================================================
Expand All @@ -6960,7 +7029,7 @@ subroutine MAPL_GridCompGetFriendlies3 ( GC, TO, BUNDLE, RC )
integer :: STATUS, I

do I=1,size(GC)
call MAPL_GridCompGetFriendlies0(GC(I), TO, BUNDLE, RC=STATUS)
call MAPL_GridCompGetFriendlies0(GC(I), TO, BUNDLE, AddGCPrefix, RC=STATUS)
VERIFY_(STATUS)
end do

Expand Down

0 comments on commit 4a0fb2d

Please sign in to comment.