OGS
VariableType.cpp
Go to the documentation of this file.
1
11#include "VariableType.h"
12
13#include <boost/algorithm/string/predicate.hpp>
14
15#include "BaseLib/Error.h"
16
17namespace MaterialPropertyLib
18{
19Variable convertStringToVariable(std::string const& string)
20{
21 for (int i = 0; i < static_cast<int>(Variable::number_of_variables); ++i)
22 {
23 if (boost::iequals(string, variable_enum_to_string[i]))
24 {
25 return static_cast<Variable>(i);
26 }
27 }
28
30 "The variable name '{:s}' does not correspond to any known variable",
31 string);
32}
33} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
static const std::array< std::string, static_cast< int >(Variable::number_of_variables)> variable_enum_to_string
Variable convertStringToVariable(std::string const &string)