OGS
CreateExponential.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include <unordered_set>
5
7#include "Exponential.h"
8
10{
11std::unique_ptr<Exponential> createExponential(
12 BaseLib::ConfigTree const& config)
13{
15 config.checkConfigParameter("type", "Exponential");
16
17 // Second access for storage.
19 auto property_name = config.peekConfigParameter<std::string>("name");
20
21 DBUG("Create Exponential property {:s}.", property_name);
22 auto const reference_value =
24 config.getConfigParameter<double>("reference_value");
25
26 auto const& exponent_data_config =
28 config.getConfigSubtree("exponent");
29
30 auto const& variable_name =
32 exponent_data_config.getConfigParameter<std::string>("variable_name");
33 auto const reference_condition =
35 exponent_data_config.getConfigParameter<double>("reference_condition");
36 auto const factor =
38 exponent_data_config.getConfigParameter<double>("factor");
39
40 auto const offset =
42 config.getConfigParameter<double>("offset");
43
44 static const std::unordered_set<std::string> filter_not_variables = {
45 "t", "x", "y", "z"};
47 if (filter_not_variables.contains(variable_name))
48 {
49 exp_data_type = variable_name;
50 }
51 else
52 {
53 exp_data_type =
55 }
56
58 exp_data_type, reference_condition, factor};
59
60 return std::make_unique<MaterialPropertyLib::Exponential>(
61 std::move(property_name), offset, reference_value, exp_data);
62}
63} // namespace MaterialPropertyLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
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:12
std::unique_ptr< Exponential > createExponential(BaseLib::ConfigTree const &config)
Variable convertStringToVariable(std::string const &string)