diff --git a/ProcessLib/Utils/ProcessUtils.cpp b/ProcessLib/Utils/ProcessUtils.cpp index 1c3a726a805008cf25304548a6abfe3b9a5679df..ff4f3fc68108ad0020b3b78d2cf007d884a8e9d5 100644 --- a/ProcessLib/Utils/ProcessUtils.cpp +++ b/ProcessLib/Utils/ProcessUtils.cpp @@ -77,19 +77,22 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables( std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables( std::vector<ProcessVariable> const& variables, - BaseLib::ConfigTree const& pv_config, - std::string const& tag) + BaseLib::ConfigTree const& pv_config, std::string const& tag, + bool const optional) { - std::vector<std::reference_wrapper<ProcessVariable>> vars; - //! \ogs_file_special auto var_names = pv_config.getConfigParameterList<std::string>(tag); if (var_names.empty()) { + if (optional) + { + return {}; + } OGS_FATAL("No entity is found with config tag <{:s}>.", tag); } + std::vector<std::reference_wrapper<ProcessVariable>> vars; std::vector<std::string> cached_var_names; for (std::string const& var_name : var_names) diff --git a/ProcessLib/Utils/ProcessUtils.h b/ProcessLib/Utils/ProcessUtils.h index c44900ac57ba4eea8a42b90f11966f379e2c204b..e78c084f02db804d51b6fa2a22430e305a88ac81 100644 --- a/ProcessLib/Utils/ProcessUtils.h +++ b/ProcessLib/Utils/ProcessUtils.h @@ -50,7 +50,7 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables( std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables( std::vector<ProcessVariable> const& variables, - BaseLib::ConfigTree const& pv_config, - std::string const& tag); + BaseLib::ConfigTree const& pv_config, std::string const& tag, + bool const optional = false); } // namespace ProcessLib