OGS 6.2.0-97-g4a610c866
CurveScaledParameter.cpp
Go to the documentation of this file.
1 
10 #include "CurveScaledParameter.h"
11 #include "Utils.h"
12 
13 namespace ParameterLib
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  {
32  OGS_FATAL("Curve `%s' does not exists.", curve_name.c_str());
33  }
34 
35  auto referenced_parameter_name =
37  config.getConfigParameter<std::string>("parameter");
38  DBUG("Using parameter %s", referenced_parameter_name.c_str());
39 
40  // TODO other data types than only double
41  return std::make_unique<CurveScaledParameter<double>>(
42  name, *curve_it->second, referenced_parameter_name);
43 }
44 
45 } // namespace ParameterLib
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:63