OGS
FunctionParameter.cpp
Go to the documentation of this file.
1
11#include "FunctionParameter.h"
12
13#include "BaseLib/ConfigTree.h"
14
15namespace ParameterLib
16{
17std::unique_ptr<ParameterBase> createFunctionParameter(
18 std::string const& name, BaseLib::ConfigTree const& config,
19 std::map<std::string,
20 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
21 curves)
22{
24 config.checkConfigParameter("type", "Function");
25
26 std::vector<std::string> vec_expressions;
27
29 for (auto const& p : config.getConfigSubtreeList("expression"))
30 {
31 std::string const expression_str = p.getValue<std::string>();
32 vec_expressions.emplace_back(expression_str);
33 }
34
35 return std::make_unique<FunctionParameter<double>>(name, vec_expressions,
36 curves);
37}
38
39} // namespace ParameterLib
Range< SubtreeIterator > getConfigSubtreeList(std::string const &root) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< ParameterBase > createFunctionParameter(std::string const &name, BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)