OGS
CreateExponential.cpp
Go to the documentation of this file.
1 
13 #include "BaseLib/ConfigTree.h"
14 #include "Exponential.h"
15 
16 namespace MaterialPropertyLib
17 {
18 std::unique_ptr<Exponential> createExponential(
19  BaseLib::ConfigTree const& config)
20 {
22  config.checkConfigParameter("type", "Exponential");
23 
24  // Second access for storage.
26  auto property_name = config.peekConfigParameter<std::string>("name");
27 
28  DBUG("Create Exponential property {:s}.", property_name);
29  auto const reference_value =
31  config.getConfigParameter<double>("reference_value");
32 
33  auto const& exponent_data_config =
35  config.getConfigSubtree("exponent");
36 
37  auto const& variable_name =
39  exponent_data_config.getConfigParameter<std::string>("variable_name");
40  auto const reference_condition =
42  exponent_data_config.getConfigParameter<double>("reference_condition");
43  auto const factor =
45  exponent_data_config.getConfigParameter<double>("factor");
46 
47  auto const offset =
49  config.getConfigParameter<double>("offset");
50 
51  MaterialPropertyLib::Variable exp_data_type =
53 
54  MaterialPropertyLib::ExponentData const exp_data{
55  exp_data_type, reference_condition, factor};
56 
57  return std::make_unique<MaterialPropertyLib::Exponential>(
58  std::move(property_name), offset, reference_value, exp_data);
59 }
60 } // namespace MaterialPropertyLib
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
T peekConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, T const &value) const
T getConfigParameter(std::string const &param) const
ConfigTree getConfigSubtree(std::string const &root) const
Definition: ConfigTree.cpp:146
std::unique_ptr< Exponential > createExponential(BaseLib::ConfigTree const &config)
Variable convertStringToVariable(std::string const &string)