Revision 9baf475b3d65ab50080123f341f7a7c4dda2b88a authored by renchao_lu on 24 June 2021, 14:38:47 UTC, committed by renchao_lu on 27 June 2021, 11:18:31 UTC
1 parent 9100b69
CurveScaledParameter.cpp
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "CurveScaledParameter.h"
#include "Utils.h"
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)
{
//! \ogs_file_param{prj__parameters__parameter__type}
config.checkConfigParameter("type", "CurveScaled");
//! \ogs_file_param{prj__parameters__parameter__CurveScaled__curve}
auto curve_name = config.getConfigParameter<std::string>("curve");
DBUG("Using curve {:s}", curve_name);
auto const curve_it = curves.find(curve_name);
if (curve_it == curves.end())
{
OGS_FATAL("Curve `{:s}' does not exists.", curve_name);
}
auto referenced_parameter_name =
//! \ogs_file_param{prj__parameters__parameter__CurveScaled__parameter}
config.getConfigParameter<std::string>("parameter");
DBUG("Using parameter {:s}", referenced_parameter_name);
// TODO other data types than only double
return std::make_unique<CurveScaledParameter<double>>(
name, *curve_it->second, referenced_parameter_name);
}
} // namespace ParameterLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...