21 std::vector<ProcessLib::ProcessVariable>
const& variables,
22 std::string
const& name, std::string
const& tag)
25 auto variable = std::find_if(variables.cbegin(), variables.cend(),
27 { return v.getName() == name; });
29 if (variable == variables.end())
32 "There is no entry of the defined process variable '{:s}' in the "
33 "provided variables list (see tag <process_variables>). A "
34 "definition is required for config tag <{:s}>.",
37 DBUG(
"Found process variable '{:s}' for config tag <{:s}>.",
38 variable->getName(), tag);
48 std::vector<ProcessVariable>
const& variables,
54 return findVariableByName(variables, name, tag);
58 std::vector<ProcessVariable>
const& variables,
60 std::initializer_list<std::string>
63 std::vector<std::reference_wrapper<ProcessVariable>> vars;
64 vars.reserve(variables.size());
66 if (variables.size() > tags.size())
67 DBUG(
"Found multiple process variables with a same tag.");
69 for (
auto& tag : tags)
72 vars.insert(vars.end(), vars_per_tag.begin(), vars_per_tag.end());
79 std::vector<ProcessVariable>
const& variables,
81 std::string
const& tag)
83 std::vector<std::reference_wrapper<ProcessVariable>> vars;
88 if (var_names.empty())
90 OGS_FATAL(
"No entity is found with config tag <{:s}>.", tag);
93 std::vector<std::string> cached_var_names;
95 for (std::string
const& var_name : var_names)
97 vars.emplace_back(findVariableByName(variables, var_name, tag));
98 cached_var_names.push_back(var_name);
104 if (cached_var_names.size() != var_names.size())
106 OGS_FATAL(
"Found duplicates with config tag <{:s}>.", tag);
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
T getConfigParameter(std::string const ¶m) const
Range< ValueIterator< T > > getConfigParameterList(std::string const ¶m) const
void makeVectorUnique(std::vector< T > &v)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
ProcessVariable & findProcessVariable(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::string const &tag)
ProcessLib::ProcessVariable & findVariableByName(std::vector< ProcessLib::ProcessVariable > const &variables, std::string const &name, std::string const &tag)