ESMF_ConfigLoadFile Subroutine

public subroutine ESMF_ConfigLoadFile(config, filename, keywordEnforcer, delayout, unique, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Config), intent(inout) :: config
character(len=*), intent(in) :: filename
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
type(ESMF_DELayout), intent(in), optional :: delayout
logical, intent(in), optional :: unique
integer, intent(out), optional :: rc

Calls

proc~~esmf_configloadfile~~CallsGraph proc~esmf_configloadfile ESMF_ConfigLoadFile c_esmc_hconfigtoconfig c_esmc_hconfigtoconfig proc~esmf_configloadfile->c_esmc_hconfigtoconfig proc~esmf_configgetinit ESMF_ConfigGetInit proc~esmf_configloadfile->proc~esmf_configgetinit proc~esmf_configloadfile_1proc_ ESMF_ConfigLoadFile_1proc_ proc~esmf_configloadfile->proc~esmf_configloadfile_1proc_ proc~esmf_configparseattributes ESMF_ConfigParseAttributes proc~esmf_configloadfile->proc~esmf_configparseattributes proc~esmf_hconfigfileload ESMF_HConfigFileLoad proc~esmf_configloadfile->proc~esmf_hconfigfileload proc~esmf_imerr ESMF_IMErr proc~esmf_configloadfile->proc~esmf_imerr proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_configloadfile->proc~esmf_logfounderror proc~esmf_logwrite ESMF_LogWrite proc~esmf_configloadfile->proc~esmf_logwrite proc~esmf_utilstringlowercase ESMF_UtilStringLowerCase proc~esmf_configloadfile->proc~esmf_utilstringlowercase proc~esmf_configloadfile_1proc_->proc~esmf_configgetinit proc~esmf_configloadfile_1proc_->proc~esmf_imerr proc~esmf_configloadfile_1proc_->proc~esmf_logfounderror proc~clstext clstext proc~esmf_configloadfile_1proc_->proc~clstext proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_configloadfile_1proc_->proc~esmf_utiliounitget proc~opntext opntext proc~esmf_configloadfile_1proc_->proc~opntext proc~esmf_configparseattributes->proc~esmf_configgetinit proc~esmf_configparseattributes->proc~esmf_imerr proc~esmf_configparseattributes->proc~esmf_logfounderror proc~esmf_logseterror ESMF_LogSetError proc~esmf_configparseattributes->proc~esmf_logseterror proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_configparseattributes->proc~esmf_utilarray2string proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_configparseattributes->proc~esmf_utilstring2array proc~index_ index_ proc~esmf_configparseattributes->proc~index_ proc~esmf_hconfigfileload->proc~esmf_imerr proc~esmf_hconfigfileload->proc~esmf_logfounderror c_esmc_hconfigfileload c_esmc_hconfigfileload proc~esmf_hconfigfileload->c_esmc_hconfigfileload proc~esmf_hconfiggetinit ESMF_HConfigGetInit proc~esmf_hconfigfileload->proc~esmf_hconfiggetinit proc~esmf_imerr->proc~esmf_logfounderror proc~esmf_initcheckdeep ESMF_InitCheckDeep proc~esmf_imerr->proc~esmf_initcheckdeep proc~esmf_logfounderror->proc~esmf_logwrite esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_logopenfile->proc~esmf_utiliounitget c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg proc~esmf_logseterror->proc~esmf_logwrite proc~esmf_logseterror->esmf_breakpoint proc~esmf_logseterror->proc~esmf_logrc2msg proc~esmf_utilstringuppercase ESMF_UtilStringUpperCase proc~opntext->proc~esmf_utilstringuppercase

Called by

proc~~esmf_configloadfile~~CalledByGraph proc~esmf_configloadfile ESMF_ConfigLoadFile proc~complianceinitialize ComplianceInitialize proc~complianceinitialize->proc~esmf_configloadfile proc~esmf_compconstruct ESMF_CompConstruct proc~esmf_compconstruct->proc~esmf_configloadfile proc~esmf_compset ESMF_CompSet proc~esmf_compset->proc~esmf_configloadfile proc~esmf_frameworkinternalinit ESMF_FrameworkInternalInit proc~esmf_frameworkinternalinit->proc~esmf_configloadfile proc~f_esmf_configloadfile f_esmf_configloadfile proc~f_esmf_configloadfile->proc~esmf_configloadfile proc~initialization Initialization proc~initialization->proc~esmf_configloadfile proc~read_descriptor_files read_descriptor_files proc~read_descriptor_files->proc~esmf_configloadfile proc~read_dist_specification read_dist_specification proc~read_dist_specification->proc~esmf_configloadfile proc~read_grid_specification read_grid_specification proc~read_grid_specification->proc~esmf_configloadfile proc~read_redistribution_grid read_redistribution_grid proc~read_grid_specification->proc~read_redistribution_grid proc~read_regridding_grid read_regridding_grid proc~read_grid_specification->proc~read_regridding_grid proc~read_redistribution_grid->proc~esmf_configloadfile proc~read_regridding_grid->proc~esmf_configloadfile proc~read_testharness_config Read_TestHarness_Config proc~read_testharness_config->proc~esmf_configloadfile program~esmf_appdriver ESMF_AppDriver program~esmf_appdriver->proc~esmf_configloadfile program~esmf_configoverviewex ESMF_ConfigOverviewEx program~esmf_configoverviewex->proc~esmf_configloadfile program~esmf_hconfigex ESMF_HConfigEx program~esmf_hconfigex->proc~esmf_configloadfile program~esmf_hconfigutest ESMF_HConfigUTest program~esmf_hconfigutest->proc~esmf_configloadfile proc~esmf_cplcompcreate ESMF_CplCompCreate proc~esmf_cplcompcreate->proc~esmf_compconstruct proc~esmf_cplcompset ESMF_CplCompSet proc~esmf_cplcompset->proc~esmf_compset proc~esmf_gridcompcreate ESMF_GridCompCreate proc~esmf_gridcompcreate->proc~esmf_compconstruct proc~esmf_gridcompset ESMF_GridCompSet proc~esmf_gridcompset->proc~esmf_compset proc~esmf_initialize ESMF_Initialize proc~esmf_initialize->proc~esmf_frameworkinternalinit proc~esmf_scicompcreate ESMF_SciCompCreate proc~esmf_scicompcreate->proc~esmf_compconstruct proc~esmf_scicompset ESMF_SciCompSet proc~esmf_scicompset->proc~esmf_compset proc~f_esmf_compinsertvm f_esmf_compinsertvm proc~f_esmf_compinsertvm->proc~esmf_compset proc~f_esmf_compreplicate f_esmf_compreplicate proc~f_esmf_compreplicate->proc~esmf_compset proc~f_esmf_compsetvminfo f_esmf_compsetvminfo proc~f_esmf_compsetvminfo->proc~esmf_compset proc~f_esmf_frameworkinitialize f_esmf_frameworkinitialize proc~f_esmf_frameworkinitialize->proc~esmf_frameworkinternalinit proc~read_testharness_specifier Read_TestHarness_Specifier proc~read_testharness_specifier->proc~read_descriptor_files proc~read_testharness_specifier->proc~read_dist_specification proc~read_testharness_specifier->proc~read_grid_specification proc~registeric~2 registerIC proc~registeric~2->proc~complianceinitialize program~esmf_test_harness esmf_test_harness program~esmf_test_harness->proc~read_testharness_config

Source Code

    subroutine ESMF_ConfigLoadFile(config, filename, &
      keywordEnforcer, delayout, & ! DEPRECATED ARGUMENT
      unique, rc)

! !ARGUMENTS:
      type(ESMF_Config),   intent(inout)         :: config
      character(len=*),    intent(in)            :: filename
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      type(ESMF_DELayout), intent(in),  optional :: delayout  ! DEPRECATED ARGUMENT
      logical,             intent(in),  optional :: unique
      integer,             intent(out), optional :: rc
!
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \item\apiStatusModifiedSinceVersion{5.2.0r}
! \begin{description}
! \item[8.5.0] Added support for loading basic YAML files.\newline
!    Marked argument {\tt delayout} as deprecated. This argument was
!    never used internally, and it is unclear what the original intention was.
! \end{description}
! \end{itemize}
!
! !DESCRIPTION: 
!  The resource file named {\tt filename} is loaded into memory. Both the
!  classic Config file format, described in this document, and the YAML file
!  format are supported. YAML support is limited to a small subset of the full
!  YAML language specification, allowing access through the classic Config API.
!  Specifically, in YAML mode, the top level is expected to be a mapping
!  (dictionary) of scalar keys to the following value options:
!  \begin{itemize}
!  \item Scalars
!  \item List of scalars
!  \item List of lists of scalars
!  \end{itemize}
!  All other YAML constructs are silently ignored when loaded through this
!  interface. Constructs successfully ingested become available in the
!  {\tt config} object, and can be accessed via the regular {\tt ESMF\_Config}
!  methods.
!
!   The arguments are:
!   \begin{description}
!   \item [config]
!     Already created {\tt ESMF\_Config} object.
!   \item [filename]
!     Name of the configuration file. Files ending in {\tt .yaml}, {\tt .yml},
!     or any combination of upper and lower case letters that can be mapped
!     to these two options, are interpreted as YAML files. All other names
!     are interpreted as classic Config files.
!   \item [{[delayout]}] ! DEPRECATED ARGUMENT
!     {\tt ESMF\_DELayout} associated with this {\tt config} object.
!     This argument is not currently used.
!   \item [{[unique]}]
!     If specified as true, uniqueness of labels are checked and 
!     error code set if duplicates found.
!   \item [{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOP -------------------------------------------------------------------

      integer :: localrc
      character(len=len(filename))  :: lower_filename
      character(len=*), parameter   :: dotYaml=".yaml"
      character(len=*), parameter   :: dotYml=".yml"

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

      !check variables
      ESMF_INIT_CHECK_DEEP(ESMF_ConfigGetInit,config,rc)

      lower_filename = ESMF_UtilStringLowerCase(trim(filename), rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

      if ((lower_filename(len(lower_filename)-len(dotYaml)+1:)==dotYaml) &
        .or. (lower_filename(len(lower_filename)-len(dotYml)+1:)==dotYml)) &
        then
        ! This is a YAML file

        call ESMF_HConfigFileLoad(config%cptr%hconfig, trim(filename), &
          rc=localrc)
        if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return

        ! construct a regular Config from HConfig to the level possible
        call c_ESMC_HConfigToConfig(config%cptr%hconfig, config, localrc)
        if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return
      else
        ! Assume this is an old Config resource file

        call ESMF_ConfigLoadFile_1proc_( config, filename, localrc )
        if (ESMF_LogFoundError(localrc, &
          msg="unable to load file: " // trim (filename), &
          ESMF_CONTEXT, rcToReturn=rc)) return
      endif

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

      if ( present (delayout) ) then
       call ESMF_LogWrite("DELayout not used yet", ESMF_LOGMSG_WARNING, &
                           ESMF_CONTEXT)
      endif

      ! return successfully
      if (present(rc)) rc = ESMF_SUCCESS

    end subroutine ESMF_ConfigLoadFile