OGS
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
CreateExponential.cpp
Go to the documentation of this file.
1
13#include <unordered_set>
14
15#include "BaseLib/ConfigTree.h"
16#include "Exponential.h"
17
18namespace MaterialPropertyLib
19{
20std::unique_ptr<Exponential> createExponential(
21 BaseLib::ConfigTree const& config)
22{
24 config.checkConfigParameter("type", "Exponential");
25
26 // Second access for storage.
28 auto property_name = config.peekConfigParameter<std::string>("name");
29
30 DBUG("Create Exponential property {:s}.", property_name);
31 auto const reference_value =
33 config.getConfigParameter<double>("reference_value");
34
35 auto const& exponent_data_config =
37 config.getConfigSubtree("exponent");
38
39 auto const& variable_name =
41 exponent_data_config.getConfigParameter<std::string>("variable_name");
42 auto const reference_condition =
44 exponent_data_config.getConfigParameter<double>("reference_condition");
45 auto const factor =
47 exponent_data_config.getConfigParameter<double>("factor");
48
49 auto const offset =
51 config.getConfigParameter<double>("offset");
52
53 static const std::unordered_set<std::string> filter_not_variables = {
54 "t", "x", "y", "z"};
56 if (filter_not_variables.contains(variable_name))
57 {
58 exp_data_type = variable_name;
59 }
60 else
61 {
62 exp_data_type =
64 }
65
67 exp_data_type, reference_condition, factor};
68
69 return std::make_unique<MaterialPropertyLib::Exponential>(
70 std::move(property_name), offset, reference_value, exp_data);
71}
72} // namespace MaterialPropertyLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T peekConfigParameter(std::string const &param) const
T getConfigParameter(std::string const &param) const
ConfigTree getConfigSubtree(std::string const &root) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::variant< std::string, Variable > StringOrVariable
Definition Curve.h:18
std::unique_ptr< Exponential > createExponential(BaseLib::ConfigTree const &config)
Variable convertStringToVariable(std::string const &string)