ESMF_ConfigCreateFromSection Function

private function ESMF_ConfigCreateFromSection(config, openlabel, closelabel, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Config) :: config
character(len=*), intent(in) :: openlabel
character(len=*), intent(in) :: closelabel
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: rc

Return Value type(ESMF_Config)


Calls

proc~~esmf_configcreatefromsection~~CallsGraph proc~esmf_configcreatefromsection ESMF_ConfigCreateFromSection interface~esmf_configcreate ESMF_ConfigCreate proc~esmf_configcreatefromsection->interface~esmf_configcreate interface~esmf_hconfigcreate ESMF_HConfigCreate proc~esmf_configcreatefromsection->interface~esmf_hconfigcreate proc~esmf_configfindlabel ESMF_ConfigFindLabel proc~esmf_configcreatefromsection->proc~esmf_configfindlabel proc~esmf_configfindnextlabel ESMF_ConfigFindNextLabel proc~esmf_configcreatefromsection->proc~esmf_configfindnextlabel proc~esmf_configparseattributes ESMF_ConfigParseAttributes proc~esmf_configcreatefromsection->proc~esmf_configparseattributes proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_configcreatefromsection->proc~esmf_logfounderror proc~esmf_logseterror ESMF_LogSetError proc~esmf_configcreatefromsection->proc~esmf_logseterror interface~esmf_configcreate->proc~esmf_configcreatefromsection proc~esmf_configcreatedefault ESMF_ConfigCreateDefault interface~esmf_configcreate->proc~esmf_configcreatedefault proc~esmf_hconfigcreatedefault ESMF_HConfigCreateDefault interface~esmf_hconfigcreate->proc~esmf_hconfigcreatedefault proc~esmf_hconfigcreatehconfig ESMF_HConfigCreateHConfig interface~esmf_hconfigcreate->proc~esmf_hconfigcreatehconfig proc~esmf_hconfigcreatei4 ESMF_HConfigCreateI4 interface~esmf_hconfigcreate->proc~esmf_hconfigcreatei4 proc~esmf_hconfigcreatei4seq ESMF_HConfigCreateI4Seq interface~esmf_hconfigcreate->proc~esmf_hconfigcreatei4seq proc~esmf_hconfigcreatei8 ESMF_HConfigCreateI8 interface~esmf_hconfigcreate->proc~esmf_hconfigcreatei8 proc~esmf_hconfigcreatei8seq ESMF_HConfigCreateI8Seq interface~esmf_hconfigcreate->proc~esmf_hconfigcreatei8seq proc~esmf_hconfigcreatelogical ESMF_HConfigCreateLogical interface~esmf_hconfigcreate->proc~esmf_hconfigcreatelogical proc~esmf_hconfigcreatelogicalseq ESMF_HConfigCreateLogicalSeq interface~esmf_hconfigcreate->proc~esmf_hconfigcreatelogicalseq proc~esmf_hconfigcreater4 ESMF_HConfigCreateR4 interface~esmf_hconfigcreate->proc~esmf_hconfigcreater4 proc~esmf_hconfigcreater4seq ESMF_HConfigCreateR4Seq interface~esmf_hconfigcreate->proc~esmf_hconfigcreater4seq proc~esmf_hconfigcreater8 ESMF_HConfigCreateR8 interface~esmf_hconfigcreate->proc~esmf_hconfigcreater8 proc~esmf_hconfigcreater8seq ESMF_HConfigCreateR8Seq interface~esmf_hconfigcreate->proc~esmf_hconfigcreater8seq proc~esmf_hconfigcreatestringseq ESMF_HConfigCreateStringSeq interface~esmf_hconfigcreate->proc~esmf_hconfigcreatestringseq proc~esmf_configfindlabel->proc~esmf_logfounderror proc~esmf_configgetinit ESMF_ConfigGetInit proc~esmf_configfindlabel->proc~esmf_configgetinit proc~esmf_imerr ESMF_IMErr proc~esmf_configfindlabel->proc~esmf_imerr proc~index_ index_ proc~esmf_configfindlabel->proc~index_ proc~esmf_configfindnextlabel->proc~esmf_logfounderror proc~esmf_configfindnextlabel->proc~esmf_configgetinit proc~esmf_configfindnextlabel->proc~esmf_imerr proc~esmf_configfindnextlabel->proc~index_ proc~esmf_configparseattributes->proc~esmf_logfounderror proc~esmf_configparseattributes->proc~esmf_logseterror proc~esmf_configparseattributes->proc~esmf_configgetinit proc~esmf_configparseattributes->proc~esmf_imerr proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_configparseattributes->proc~esmf_utilarray2string proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_configparseattributes->proc~esmf_utilstring2array proc~esmf_configparseattributes->proc~index_ esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_logseterror->esmf_breakpoint proc~esmf_logseterror->proc~esmf_logrc2msg proc~esmf_logseterror->proc~esmf_logwrite

Called by

proc~~esmf_configcreatefromsection~~CalledByGraph proc~esmf_configcreatefromsection ESMF_ConfigCreateFromSection interface~esmf_configcreate ESMF_ConfigCreate proc~esmf_configcreatefromsection->interface~esmf_configcreate interface~esmf_configcreate->proc~esmf_configcreatefromsection proc~complianceinitialize ComplianceInitialize proc~complianceinitialize->interface~esmf_configcreate proc~esmf_compconstruct ESMF_CompConstruct proc~esmf_compconstruct->interface~esmf_configcreate proc~esmf_compset ESMF_CompSet proc~esmf_compset->interface~esmf_configcreate proc~esmf_frameworkinternalinit ESMF_FrameworkInternalInit proc~esmf_frameworkinternalinit->interface~esmf_configcreate proc~f_esmf_configcreate f_esmf_configcreate proc~f_esmf_configcreate->interface~esmf_configcreate proc~f_esmf_configcreatefromsection f_esmf_configcreatefromsection proc~f_esmf_configcreatefromsection->interface~esmf_configcreate proc~initialization Initialization proc~initialization->interface~esmf_configcreate proc~read_descriptor_files read_descriptor_files proc~read_descriptor_files->interface~esmf_configcreate proc~read_dist_specification read_dist_specification proc~read_dist_specification->interface~esmf_configcreate proc~read_grid_specification read_grid_specification proc~read_grid_specification->interface~esmf_configcreate proc~read_redistribution_grid read_redistribution_grid proc~read_redistribution_grid->interface~esmf_configcreate proc~read_regridding_grid read_regridding_grid proc~read_regridding_grid->interface~esmf_configcreate proc~read_testharness_config Read_TestHarness_Config proc~read_testharness_config->interface~esmf_configcreate proc~sections Sections proc~sections->interface~esmf_configcreate program~esmf_appdriver ESMF_AppDriver program~esmf_appdriver->interface~esmf_configcreate program~esmf_config_test ESMF_Config_Test program~esmf_config_test->interface~esmf_configcreate program~esmf_configoverviewex ESMF_ConfigOverviewEx program~esmf_configoverviewex->interface~esmf_configcreate program~esmf_hconfigex ESMF_HConfigEx program~esmf_hconfigex->interface~esmf_configcreate program~esmf_hconfigutest ESMF_HConfigUTest program~esmf_hconfigutest->interface~esmf_configcreate

Source Code

    type(ESMF_Config) function ESMF_ConfigCreateFromSection(config, &
      openlabel, closelabel, keywordEnforcer, rc)

! !ARGUMENTS:
      type(ESMF_Config)             :: config
      character(len=*),  intent(in) :: openlabel, closelabel
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      integer,intent(out), optional :: rc
!
!
! !DESCRIPTION:
!   Instantiates an {\tt ESMF\_Config} object from a section of an existing
!   {\tt ESMF\_Config} object delimited by {\tt openlabel} and {\tt closelabel}.
!   An error is returned if neither of the input labels is found in input
!   {\tt config}.
!
!   Note that a section is intended as the content of a given {\tt ESMF\_Config}
!   object delimited by two distinct labels. Such content, as well as each of the
!   surrounding labels, are still within the scope of the parent {\tt ESMF\_Config}
!   object. Therefore, including in a section labels used outside that
!   section should be done carefully to prevent parsing conflicts.
!
!   The arguments are:
!   \begin{description}
!     \item[config]
!       The input {\tt ESMF\_Config} object.
!     \item[openlabel]
!       Label marking the beginning of a section in {\tt config}.
!     \item[closelabel]
!       Label marking the end of a section in {\tt config}.
!     \item [{[rc]}]
!       Return code; equals {\tt ESMF\_SUCCESS} if a section is found
!      and a new {\tt ESMF\_Config} object returned.
!   \end{description}
!
!EOP -------------------------------------------------------------------

      integer :: localrc
      integer :: ptr, section_open, section_close
      logical, parameter :: unique = .false.

      ! Initialize return code; assume routine not implemented
      if (present(rc)) rc = ESMF_RC_NOT_IMPL

      ! Look for opening section label in whole input Config object
      call ESMF_ConfigFindLabel(config, openlabel, rc=localrc)
      if (ESMF_LogFoundError(rcToCheck=localrc, &
        msg="Opening section label not found",  &
        ESMF_CONTEXT, rcToReturn=rc)) return

      section_open = config % cptr % value_begin

      ! Look closing section label after opening label
      call ESMF_ConfigFindNextLabel(config, closelabel, rc=localrc)
      if (ESMF_LogFoundError(rcToCheck=localrc, &
        msg="Closing section label not found",  &
        ESMF_CONTEXT, rcToReturn=rc)) return

      section_close = config % cptr % value_begin - len(closelabel) - 1

      if (section_close < section_open) then
        call ESMF_LogSetError(ESMF_RC_NOT_FOUND, &
          msg="Closing section label precedes opening section label", &
          ESMF_CONTEXT, rcToReturn=rc)
        return
      end if

      ! Create and populate new Config object from parent object's section
      ESMF_ConfigCreateFromSection = ESMF_ConfigCreate(rc=localrc)
      if (ESMF_LogFoundError(rcToCheck=localrc, &
        msg="Instantiating new config object",  &
        ESMF_CONTEXT, rcToReturn=rc)) return

      ptr = section_close - section_open + 1
      if (config % cptr % buffer(section_open:section_open) == EOL) then
        ESMF_ConfigCreateFromSection % cptr % buffer(1:ptr) = &
          config % cptr % buffer(section_open:section_close)
      else
        ptr = ptr + 1
        ESMF_ConfigCreateFromSection % cptr % buffer(1:1) = EOL
        ESMF_ConfigCreateFromSection % cptr % buffer(2:ptr) = &
          config % cptr % buffer(section_open:section_close)
      end if

      ptr = ptr + 1
      ESMF_ConfigCreateFromSection % cptr % nbuf = ptr
      ESMF_ConfigCreateFromSection % cptr % buffer(ptr:ptr) = EOB

      ESMF_ConfigCreateFromSection % cptr % next_line = 2
      ESMF_ConfigCreateFromSection % cptr % next_item = 1
      ESMF_ConfigCreateFromSection % cptr % eolflag = .false.
      ESMF_ConfigCreateFromSection % cptr % value_begin = 1

      call ESMF_ConfigParseAttributes(ESMF_ConfigCreateFromSection, &
        unique=unique, rc=localrc)
      if (ESMF_LogFoundError(rcToCheck=localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

      ESMF_ConfigCreateFromSection%cptr%hconfig_owner = .true.
      ESMF_ConfigCreateFromSection%cptr%hconfig = ESMF_HConfigCreate(rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU,  &
        ESMF_CONTEXT, rcToReturn=rc)) return

      if (present(rc)) rc = ESMF_SUCCESS

      ESMF_INIT_SET_CREATED(ESMF_ConfigCreateFromSection)
      return

    end function ESMF_ConfigCreateFromSection