OGS
FunctionParameter.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 "FunctionParameter.h"
5
7
8namespace ParameterLib
9{
10std::unique_ptr<ParameterBase> createFunctionParameter(
11 std::string const& name, BaseLib::ConfigTree const& config,
12 std::map<std::string,
13 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
14 curves)
15{
17 config.checkConfigParameter("type", "Function");
18
19 std::vector<std::string> vec_expressions;
20
22 for (auto const& p : config.getConfigSubtreeList("expression"))
23 {
24 std::string const expression_str = p.getValue<std::string>();
25 vec_expressions.emplace_back(expression_str);
26 }
27
28 return std::make_unique<FunctionParameter<double>>(name, vec_expressions,
29 curves);
30}
31
32} // 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)