MAPL_GetResource_config_scalar Subroutine

public subroutine MAPL_GetResource_config_scalar(config, val, label, value_is_set, unusable, default, component_name, iunit, rc)

Find value of scalar variable in config

Arguments

Type IntentOptional 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

Calls

proc~~mapl_getresource_config_scalar~~CallsGraph proc~mapl_getresource_config_scalar MAPL_GetResource_config_scalar ESMF_ConfigFindLabel ESMF_ConfigFindLabel proc~mapl_getresource_config_scalar->ESMF_ConfigFindLabel ESMF_ConfigGetAttribute ESMF_ConfigGetAttribute proc~mapl_getresource_config_scalar->ESMF_ConfigGetAttribute begin begin proc~mapl_getresource_config_scalar->begin interface~mapl_am_i_root MAPL_Am_I_Root proc~mapl_getresource_config_scalar->interface~mapl_am_i_root interface~mapl_assert MAPL_Assert proc~mapl_getresource_config_scalar->interface~mapl_assert next next proc~mapl_getresource_config_scalar->next of of proc~mapl_getresource_config_scalar->of proc~mapl_return MAPL_Return proc~mapl_getresource_config_scalar->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_getresource_config_scalar->proc~mapl_verify push_back push_back proc~mapl_getresource_config_scalar->push_back at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Called by

proc~~mapl_getresource_config_scalar~~CalledByGraph proc~mapl_getresource_config_scalar MAPL_GetResource_config_scalar proc~test_mapl_getresource_scalar_character Test_MAPL_GetResource_scalar_character proc~test_mapl_getresource_scalar_character->proc~mapl_getresource_config_scalar proc~test_mapl_getresource_scalar_int4 Test_MAPL_GetResource_scalar_int4 proc~test_mapl_getresource_scalar_int4->proc~mapl_getresource_config_scalar proc~test_mapl_getresource_scalar_int8 Test_MAPL_GetResource_scalar_int8 proc~test_mapl_getresource_scalar_int8->proc~mapl_getresource_config_scalar proc~test_mapl_getresource_scalar_logical Test_MAPL_GetResource_scalar_logical proc~test_mapl_getresource_scalar_logical->proc~mapl_getresource_config_scalar proc~test_mapl_getresource_scalar_real4 Test_MAPL_GetResource_scalar_real4 proc~test_mapl_getresource_scalar_real4->proc~mapl_getresource_config_scalar proc~test_mapl_getresource_scalar_real8 Test_MAPL_GetResource_scalar_real8 proc~test_mapl_getresource_scalar_real8->proc~mapl_getresource_config_scalar

Source Code

   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