MAPL_GetResource_config_array Subroutine

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

Find value of array 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_array~~CallsGraph proc~mapl_getresource_config_array MAPL_GetResource_config_array ESMF_ConfigFindLabel ESMF_ConfigFindLabel proc~mapl_getresource_config_array->ESMF_ConfigFindLabel ESMF_ConfigGetAttribute ESMF_ConfigGetAttribute proc~mapl_getresource_config_array->ESMF_ConfigGetAttribute begin begin proc~mapl_getresource_config_array->begin interface~mapl_am_i_root MAPL_Am_I_Root proc~mapl_getresource_config_array->interface~mapl_am_i_root interface~mapl_assert MAPL_Assert proc~mapl_getresource_config_array->interface~mapl_assert next next proc~mapl_getresource_config_array->next of of proc~mapl_getresource_config_array->of proc~mapl_return MAPL_Return proc~mapl_getresource_config_array->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_getresource_config_array->proc~mapl_verify push_back push_back proc~mapl_getresource_config_array->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_array~~CalledByGraph proc~mapl_getresource_config_array MAPL_GetResource_config_array proc~test_mapl_getresource_array_character Test_MAPL_GetResource_array_character proc~test_mapl_getresource_array_character->proc~mapl_getresource_config_array proc~test_mapl_getresource_array_int4 Test_MAPL_GetResource_array_int4 proc~test_mapl_getresource_array_int4->proc~mapl_getresource_config_array proc~test_mapl_getresource_array_int8 Test_MAPL_GetResource_array_int8 proc~test_mapl_getresource_array_int8->proc~mapl_getresource_config_array proc~test_mapl_getresource_array_logical Test_MAPL_GetResource_array_logical proc~test_mapl_getresource_array_logical->proc~mapl_getresource_config_array proc~test_mapl_getresource_array_real4 Test_MAPL_GetResource_array_real4 proc~test_mapl_getresource_array_real4->proc~mapl_getresource_config_array proc~test_mapl_getresource_array_real8 Test_MAPL_GetResource_array_real8 proc~test_mapl_getresource_array_real8->proc~mapl_getresource_config_array

Source Code

   subroutine MAPL_GetResource_config_array(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
      ! We assume we will never have more than 99 values, hence len=2

      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 :: count

      integer :: io_stat
      integer :: status

      _UNUSED_DUMMY(unusable)

#if defined(TYPE_)
#undef TYPE_
#endif

#if defined(TYPENUM)
#undef TYPENUM
#endif

#if defined(IS_ARRAY)
#undef IS_ARRAY
#endif
#define IS_ARRAY

#if defined(VALUE_)
#undef VALUE_
#endif
#define VALUE_ val

#if defined(MAX_CHAR_LEN)
#undef MAX_CHAR_LEN
#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)

      ! label or default must be present
      if (.not. label_is_present .and. .not. default_is_present) then
         value_is_set = .FALSE.
         return
      end if

      ! only print if root
      call get_print_settings(config, default_is_present, do_print, print_nondefault_only, _RC)

      count = size(val)

      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)

   end subroutine MAPL_GetResource_config_array