You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A VerticalDimSpec value is stored as a string in the ESMF_Info object in a ESMF_Field object. To check the VerticalDimSpec value of an ESMF_Field requires a string match to a string literal. The string literal can be stored in a parameter so that multiple string literals are created for the same VerticalDimSpec, but then matching requires knowing the parameter name. There is no guarantee that the parameter name or string literal match the name of the relevant VerticalDimSpec. This seems fragile.
Two options:
Store the string literals in parameters in the module that defines type(VerticalDimSpec). The parameters would be used to create the ESMF_Info for the VerticalDimSpec objects, and the parameters used for the creation would be public for the sake of comparison. This still requires that the parameter names be known, but it does protect against changes in the string in the ESMF_Info object.
Define type-bound logical function with a string argument that the verifies that the string corresponds to the VerticalDimSpec.
type :: VerticalDimSpec
character(len=:), allocatable :: name_
...
contains
module procedure :: matches => matches_spec
...
contains
logical function matches_spec(this, string)
class(VerticalDimSpec), intent(in) :: this
character(len=*), intent(in) :: string
matches_spec = (this%name_ == string)
end function matches_spec
The text was updated successfully, but these errors were encountered:
How would option (2) work? At the point one is examining the info object the dim spec object would generally not be available. And if it was available, there is no reason to use the info object.
The string literal can be stored in a parameter so that multiple string literals are created for the same VerticalDimSpec, but then matching requires knowing the parameter name.
A
VerticalDimSpec
value is stored as a string in theESMF_Info
object in aESMF_Field
object. To check theVerticalDimSpec
value of anESMF_Field
requires a string match to a string literal. The string literal can be stored in a parameter so that multiple string literals are created for the sameVerticalDimSpec
, but then matching requires knowing the parameter name. There is no guarantee that the parameter name or string literal match the name of the relevantVerticalDimSpec
. This seems fragile.Two options:
ESMF_Info
for the VerticalDimSpec objects, and the parameters used for the creation would be public for the sake of comparison. This still requires that the parameter names be known, but it does protect against changes in the string in theESMF_Info
object.VerticalDimSpec
.The text was updated successfully, but these errors were encountered: