OGS
CreateLinear.cpp
Go to the documentation of this file.
1
13#include "BaseLib/ConfigTree.h"
14#include "Linear.h"
15
16namespace MaterialPropertyLib
17{
18std::unique_ptr<Linear> createLinear(BaseLib::ConfigTree const& config)
19{
21 config.checkConfigParameter("type", "Linear");
22
23 // Second access for storage.
25 auto property_name = config.peekConfigParameter<std::string>("name");
26
27 DBUG("Create Linear property {:s}.", property_name);
28 auto const reference_value =
30 config.getConfigParameter<double>("reference_value");
31
32 std::vector<MaterialPropertyLib::IndependentVariable> ivs;
33 for (auto const& independent_variable_config :
35 config.getConfigSubtreeList("independent_variable"))
36 {
37 auto const& variable_name =
39 independent_variable_config.getConfigParameter<std::string>(
40 "variable_name");
41 auto const reference_condition =
43 independent_variable_config.getConfigParameter<double>(
44 "reference_condition");
45 auto const slope =
47 independent_variable_config.getConfigParameter<double>("slope");
48
51
52 MaterialPropertyLib::IndependentVariable iv{ivt, reference_condition,
53 slope};
54
55 ivs.push_back(std::move(iv));
56 }
57
58 return std::make_unique<MaterialPropertyLib::Linear>(
59 std::move(property_name), reference_value, ivs);
60}
61} // 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
Range< SubtreeIterator > getConfigSubtreeList(std::string const &root) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
Variable convertStringToVariable(std::string const &string)
std::unique_ptr< Linear > createLinear(BaseLib::ConfigTree const &config)