OGS
CurveScaledParameter.cpp
Go to the documentation of this file.
1
12
13#include "Utils.h"
14
15namespace ParameterLib
16{
17std::unique_ptr<ParameterBase> createCurveScaledParameter(
18 std::string const& name,
19 BaseLib::ConfigTree const& config,
20 std::map<std::string,
21 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
22 curves)
23{
25 config.checkConfigParameter("type", "CurveScaled");
26
28 auto curve_name = config.getConfigParameter<std::string>("curve");
29 DBUG("Using curve {:s}", curve_name);
30
31 auto const curve_it = curves.find(curve_name);
32 if (curve_it == curves.end())
33 {
34 OGS_FATAL("Curve `{:s}' does not exists.", curve_name);
35 }
36
37 auto referenced_parameter_name =
39 config.getConfigParameter<std::string>("parameter");
40 DBUG("Using parameter {:s}", referenced_parameter_name);
41
42 // TODO other data types than only double
43 return std::make_unique<CurveScaledParameter<double>>(
44 name, *curve_it->second, referenced_parameter_name);
45}
46
47} // namespace ParameterLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< ParameterBase > createCurveScaledParameter(std::string const &name, BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)