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