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 20 of file ProcessUtils.cpp.

23{
24 // Find corresponding variable by name.
25 auto variable = std::find_if(variables.cbegin(), variables.cend(),
26 [&name](ProcessLib::ProcessVariable const& v)
27 { return v.getName() == name; });
28
29 if (variable == variables.end())
30 {
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}>.",
35 name, tag);
36 }
37 DBUG("Found process variable '{:s}' for config tag <{:s}>.",
38 variable->getName(), tag);
39
40 // Const cast is needed because of variables argument constness.
41 return const_cast<ProcessLib::ProcessVariable&>(*variable);
42}
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30

References DBUG(), and OGS_FATAL.