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

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

References DBUG(), MaterialPropertyLib::name, and OGS_FATAL.

Referenced by ProcessLib::findProcessVariable(), and ProcessLib::findProcessVariables().