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