OGS
anonymous_namespace{ProcessUtils.cpp} Namespace Reference

Functions

ProcessLib::ProcessVariablefindVariableByName (std::vector< ProcessLib::ProcessVariable > const &variables, std::string const &name, std::string const &tag)

Function Documentation

◆ findVariableByName()

ProcessLib::ProcessVariable & anonymous_namespace{ProcessUtils.cpp}::findVariableByName ( std::vector< ProcessLib::ProcessVariable > const & variables,
std::string const & name,
std::string const & tag )

Definition at line 13 of file ProcessUtils.cpp.

16{
17 // Find corresponding variable by name.
18 auto variable = std::find_if(variables.cbegin(), variables.cend(),
19 [&name](ProcessLib::ProcessVariable const& v)
20 { return v.getName() == name; });
21
22 if (variable == variables.end())
23 {
25 "There is no entry of the defined process variable '{:s}' in the "
26 "provided variables list (see tag <process_variables>). A "
27 "definition is required for config tag <{:s}>.",
28 name, tag);
29 }
30 DBUG("Found process variable '{:s}' for config tag <{:s}>.",
31 variable->getName(), tag);
32
33 // Const cast is needed because of variables argument constness.
34 return const_cast<ProcessLib::ProcessVariable&>(*variable);
35}
#define OGS_FATAL(...)
Definition Error.h:19
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22

References DBUG(), and OGS_FATAL.