Find value of scalar variable in config
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ESMF_Config), | intent(inout) | :: | config | |||
class(*), | intent(inout) | :: | val | |||
character(len=*), | intent(in) | :: | label | |||
logical, | intent(out) | :: | value_is_set | |||
class(KeywordEnforcer), | intent(in), | optional | :: | unusable | ||
class(*), | intent(in), | optional | :: | default | ||
character(len=*), | intent(in), | optional | :: | component_name | ||
character(len=*), | intent(inout), | optional | :: | iunit | ||
integer, | intent(out), | optional | :: | rc |
subroutine MAPL_GetResource_config_scalar(config, val, label, value_is_set, unusable, default, component_name, iunit, rc) type(ESMF_Config), intent(inout) :: config class(*), intent(inout) :: val character(len=*), intent(in) :: label logical, intent(out) :: value_is_set class(KeywordEnforcer), optional, intent(in) :: unusable class(*), optional, intent(in) :: default character(len=*), optional, intent(in) :: component_name character(len=*), optional, intent(inout) :: iunit integer, optional, intent(out) :: rc character(len=:), allocatable :: actual_label character(len=:), allocatable :: type_format character(len=:), allocatable :: type_string character(len=MAX_LINE_LENGTH) :: formatted_value logical :: default_is_present logical :: label_is_present logical :: print_nondefault_only logical :: do_print logical :: value_is_default integer :: io_stat integer :: status _UNUSED_DUMMY(unusable) #if defined(IS_ARRAY) #undef IS_ARRAY #endif #if defined(VALUE_) #undef VALUE_ #endif #define VALUE_ val #if defined(TYPE_) #undef TYPE_ #endif #if defined(TYPENUM) #undef TYPENUM #endif default_is_present = present(default) ! these need to be initialized explicitly value_is_set = .FALSE. label_is_present = .FALSE. print_nondefault_only = .FALSE. do_print = .FALSE. value_is_default = .FALSE. if (default_is_present) then _ASSERT(same_type_as(val, default), "Value and default must have same type") end if call get_actual_label(config, label, label_is_present, actual_label, component_name = component_name, _RC) if(.not. (label_is_present .or. default_is_present)) then ! label or default must be present value_is_set = .FALSE. return end if call get_print_settings(config, default_is_present, do_print, print_nondefault_only, _RC) select type(val) type is (TYPE_INTEGER4) #define TYPE_ TYPE_INTEGER4 #define TYPENUM TYPENUM_INTEGER4 #include "MAPL_Resource_SetValue.h" #include "MAPL_Resource_MakeString.h" #undef TYPE_ #undef TYPENUM type is (TYPE_INTEGER8) #define TYPE_ TYPE_INTEGER8 #define TYPENUM TYPENUM_INTEGER8 #include "MAPL_Resource_SetValue.h" #include "MAPL_Resource_MakeString.h" #undef TYPE_ #undef TYPENUM type is (TYPE_REAL4) #define TYPE_ TYPE_REAL4 #define TYPENUM TYPENUM_REAL4 #include "MAPL_Resource_SetValue.h" #include "MAPL_Resource_MakeString.h" #undef TYPE_ #undef TYPENUM type is (TYPE_REAL8) #define TYPE_ TYPE_REAL8 #define TYPENUM TYPENUM_REAL8 #include "MAPL_Resource_SetValue.h" #include "MAPL_Resource_MakeString.h" #undef TYPE_ #undef TYPENUM type is (TYPE_LOGICAL) #define TYPE_ TYPE_LOGICAL #define TYPENUM TYPENUM_LOGICAL #include "MAPL_Resource_SetValue.h" #include "MAPL_Resource_MakeString.h" #undef TYPE_ #undef TYPENUM type is (TYPE_CHARACTER) #define TYPE_ TYPE_CHARACTER #define TYPENUM TYPENUM_CHARACTER #include "MAPL_Resource_SetValue.h" #include "MAPL_Resource_MakeString.h" #undef TYPE_ #undef TYPENUM class default _FAIL( "Unsupported type") end select if(do_print) then call print_resource(type_string, actual_label, formatted_value, value_is_default, iunit=iunit, _RC) end if _RETURN(ESMF_SUCCESS) #undef TYPE_ #undef TYPENUM end subroutine MAPL_GetResource_config_scalar