Skip to content

Commit 8fc72f9

Browse files
committed
Minor ESMF_Info upgrades
1 parent 5ced4e5 commit 8fc72f9

4 files changed

Lines changed: 76 additions & 16 deletions

File tree

src/utilities/mossco_attribute.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
!> @brief Implementation of extensions to the ESMF Attribute utilities
22
!
33
! This computer program is part of MOSSCO.
4-
!> @copyright 2021-2023 Helmholtz-Zentrum Hereon GmbH
4+
!> @copyright 2021-2025 Helmholtz-Zentrum hereon GmbH
55
!> @copyright 2015-2021 Helmholtz-Zentrum Geesthacht GmbH
66
!> @author Carsten Lemmen <carsten.lemmen@hereon.de>
77
!

src/utilities/mossco_field.F90

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
!> @brief Implementation of additional ESMF Field utilities
22
!
33
! This computer program is part of MOSSCO.
4-
!> @copyright 2021-2022 Helmholtz-Zentrum Hereon
4+
!> @copyright 2021-2025 Helmholtz-Zentrum hereon GmbH
55
!> @copyright 2015-2021 Helmholtz-Zentrum Geesthacht
66
!> @author Carsten Lemmen <carsten.lemmen@hereon.de>
77
!> @author Richard Hofmeister
@@ -2570,6 +2570,8 @@ subroutine MOSSCO_FieldWeightField(exportField, importField, weight, kwe, &
25702570
type(ESMF_Grid) :: grid
25712571
character(len=ESMF_MAXSTR), allocatable :: options(:)
25722572

2573+
type(ESMF_Info) :: exportInfo, importInfo
2574+
25732575
rc_ = ESMF_SUCCESS
25742576
owner_ = '--'
25752577
if (present(rc)) rc = rc_
@@ -2649,18 +2651,29 @@ subroutine MOSSCO_FieldWeightField(exportField, importField, weight, kwe, &
26492651
if (allocated(exportUbnd)) deallocate(exportUbnd)
26502652
if (allocated(exportLbnd)) deallocate(exportLbnd)
26512653

2652-
call MOSSCO_AttributeGet(importField, 'missing_value', importMissingValue, &
2653-
defaultValue=-1D30, convert=.true., rc=localrc)
2654+
call ESMF_InfoGetFromHost(importField, info=importInfo, rc=localrc)
2655+
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc)
2656+
2657+
call ESMF_InfoGet(importInfo, key='missing_value', value=importMissingValue, &
2658+
default=-1D30, rc=localrc)
2659+
!call MOSSCO_AttributeGet(importField, 'missing_value', importMissingValue, &
2660+
! defaultValue=-1D30, convert=.true., rc=localrc)
26542661
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
26552662

2656-
call MOSSCO_AttributeGet(exportField, 'missing_value', exportMissingValue, &
2657-
defaultValue=-1D30, convert=.true., rc=localrc)
2663+
call ESMF_InfoGetFromHost(exportField, info=exportInfo, rc=localrc)
2664+
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
2665+
2666+
call ESMF_InfoGet(exportInfo, key='missing_value', value=exportMissingValue, &
2667+
default=-1D30, rc=localrc)
2668+
!call MOSSCO_AttributeGet(exportField, 'missing_value', exportMissingValue, &
2669+
! defaultValue=-1D30, convert=.true., rc=localrc)
26582670
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
26592671

26602672
!> @todo The has_boundary_data attribute is set to .true. by default here,
26612673
!> this should be changed by a configuration attribute and the attribute name MOSSCO_AttributeGet
26622674
!> be synchronized with the transporting component (e.g. getm_component)
2663-
call ESMF_AttributeSet(exportField, 'has_boundary_data', .true., rc=localrc)
2675+
call ESMF_InfoSet(exportInfo, key='has_boundary_data', value=.true., rc=localrc)
2676+
!call ESMF_AttributeSet(exportField, 'has_boundary_data', .true., rc=localrc)
26642677
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
26652678

26662679
if (.not. tagOnly_) then
@@ -2735,6 +2748,12 @@ subroutine MOSSCO_FieldWeightField(exportField, importField, weight, kwe, &
27352748
endif
27362749
endif
27372750

2751+
call ESMF_InfoGetFromHost(importField, info=importInfo, rc=localrc)
2752+
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
2753+
2754+
call ESMF_InfoGetFromHost(exportField, info=exportInfo, rc=localrc)
2755+
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
2756+
27382757
select case (rank)
27392758
case(2)
27402759
call ESMF_FieldGet(importField, farrayPtr=importPtr2, rc=localrc)
@@ -2753,20 +2772,25 @@ subroutine MOSSCO_FieldWeightField(exportField, importField, weight, kwe, &
27532772

27542773
!> @todo add infinity to mask
27552774

2756-
call ESMF_AttributeGet(importField, 'valid_min', isPresent=isPresent, rc=localrc)
2775+
isPresent = ESMF_InfoIsPresent(importInfo, "valid_min", rc=rc)
2776+
!call ESMF_AttributeGet(importField, 'valid_min', rc=localrc)
27572777
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
27582778

27592779
if (isPresent) then
2760-
call MOSSCO_AttributeGet(importField, label='valid_min', value=real8, &
2761-
convert=.true., rc=localrc)
2780+
!call MOSSCO_AttributeGet(importField, label='valid_min', value=real8, &
2781+
! convert=.true., rc=localrc)
2782+
call ESMF_InfoGet(importInfo, key='valid_min', value=real8, rc=localrc)
27622783
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
27632784
mask2 = (mask2 .and. importPtr2(RANGE2D) >= real8)
27642785
endif
27652786

2766-
call ESMF_AttributeGet(exportField, 'valid_min', isPresent=isPresent, rc=localrc)
2787+
!call ESMF_AttributeGet(exportField, 'valid_min', isPresent=isPresent, rc=localrc)
2788+
isPresent = ESMF_InfoIsPresent(exportInfo, "valid_min", rc=rc)
2789+
_MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
27672790
if (isPresent) then
2768-
call MOSSCO_AttributeGet(importField, label='valid_min', value=real8, &
2769-
convert=.true., rc=localrc)
2791+
!call MOSSCO_AttributeGet(importField, label='valid_min', value=real8, &
2792+
! convert=.true., rc=localrc)
2793+
call ESMF_InfoGet(exportInfo, key='valid_min', value=real8, rc=localrc)
27702794
mask2 = (mask2 .and. importPtr2(RANGE2D) >= real8)
27712795
endif
27722796

src/utilities/mossco_info.F90

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
!> @brief Implementation of extensions to the ESMF Info utilities
33
!
44
! This computer program is part of MOSSCO.
5-
!> @copyright 2022 Helmholtz-Zentrum Hereon
5+
!> @copyright 2022-2025 Helmholtz-Zentrum hereon GmbH
66
!> @author Carsten Lemmen <carsten.lemmen@hereon.de>
77
!
88
! MOSSCO is free software: you can redistribute it and/or modify it under the
@@ -56,6 +56,42 @@ module mossco_info
5656

5757
contains
5858

59+
! The following is elegant but does not work currently:
60+
! Unlimited polymorphic actual argument at (1) is not matched with either an unlimited polymorphic or assumed type dummy argument
61+
!
62+
! #undef ESMF_METHOD
63+
! #define ESMF_METHOD "MOSSCO_InfoCopyKey_untyped"
64+
! subroutine MOSSCO_InfoCopyKey_untyped(to, from, key, kwe, typeKind, rc)
65+
! class(*), intent(inout) :: to
66+
! class(*), intent(in) :: from
67+
! character(len=*), intent(in) :: key
68+
! type(ESMF_KeywordEnforcer), intent(in), optional :: kwe
69+
! type(ESMF_TypeKind_Flag), intent(in), optional :: typeKind
70+
! integer(ESMF_KIND_I4), intent(out), optional :: rc
71+
72+
! type(ESMF_Info) :: toInfo, fromInfo
73+
! type(ESMF_TypeKind_Flag) :: typeKind_
74+
! integer(ESMF_KIND_I4) :: localrc, rc_
75+
76+
! rc_ = ESMF_SUCCESS
77+
! if (present(rc)) rc = rc_
78+
! if (present(kwe)) rc_ = ESMF_SUCCESS
79+
80+
! call ESMF_InfoGetFromHost(to, info=toInfo, rc=localrc)
81+
! _MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
82+
83+
! call ESMF_InfoGetFromHost(from, info=fromInfo, rc=localrc)
84+
! _MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
85+
86+
! if (present(typeKind)) then
87+
! call MOSSCO_InfoCopyKey(toInfo, fromInfo, key, typeKind=typeKind, rc=localrc)
88+
! else
89+
! call MOSSCO_InfoCopyKey(toInfo, fromInfo, key, rc=localrc)
90+
! endif
91+
! _MOSSCO_LOG_AND_FINALIZE_ON_ERROR_(rc_)
92+
93+
! end subroutine MOSSCO_InfoCopyKey_untyped
94+
5995
#undef ESMF_METHOD
6096
#define ESMF_METHOD "MOSSCO_InfoCopyKey"
6197
subroutine MOSSCO_InfoCopyKey(to, from, key, kwe, typeKind, rc)

src/utilities/mossco_state.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
!> @brief Implementation of ESMF State utilities
22
!
33
! This computer program is part of MOSSCO.
4-
!> @copyright 2021-2022 Helmholtz-Zentrum Hereon
5-
!> @copyright 2014-2021 Helmholtz-Zentrum Geesthacht
4+
!> @copyright 2021-2025 Helmholtz-Zentrum hereon GmbH
5+
!> @copyright 2014-2021 Helmholtz-Zentrum Geesthacht GmbH
66
!> @copyright 2014-2019 Institut für Ostseeforschung Warnemünde
77
!> @author Carsten Lemmen <carsten.lemmen@hereon.de>
88
!> @author Richard Hofmeister

0 commit comments

Comments
 (0)