GEOS-ESM / MAPL

MAPL is a foundation layer of the GEOS architecture, whose original purpose is to supplement the Earth System Modeling Framework (ESMF)
https://geos-esm.github.io/MAPL/
Apache License 2.0
24 stars 18 forks source link

Create setter/getter for user-level attributes #3062

Closed tclune closed 1 month ago

tclune commented 1 month ago

There are 2 types of user-level attributes to be supported by MAPL3.

  1. Shared attributes that can be accessed in multiple components. (Import/export fields shared across components.)
  2. Private attributes that are accessed only by the owning component.

Nominal structure:

<MAPL>
|   ├-- <private>
|       ├-- compA
|           ├-- attr1=...
|           ├-- attr2=...
|       ├-- compB
|           ├-- ...
|       ├-- ...
|   ├-- <shared>
|       ├-- attr1=
|       ├-- attr2=
|       ├-- ...

To (slightly) reduce the number of arguments, I suggest that a components states should all "know" the component name. This can either be through a MAPL-level attribute or encoded in the name of the state itself. Am leaning towards the former. Then the interfaces can look like this:

subroutine MAPL_InfoSetPrivate(state, short_name, key, value, rc)
subroutine MAPL_InfoGetPrivate(state, short_name, key, value, rc)
subroutine MAPL_InfoSetShared(state, short_name, key, value, rc)
subroutine MAPL_InfoGetShared(state, short_name, key, value, rc)

Each of these should be overloaded for various value types. Strings and arrays should be allocatable for the getters.

Probably should also provide a lower level interface directly on Fields that is used by the above interfaces:

subroutine MAPL_InfoSetPrivate(field, key, value, rc)
subroutine MAPL_InfoGetPrivate(field, key, value, rc)
subroutine MAPL_InfoSetShared(field, key, value, rc)
subroutine MAPL_InfoGetShared(field, key, value, rc)
tclune commented 1 month ago

@darianboggs I'll implement this but will probably discuss with you so that I am consistent with other MAPL info handling.