Revision f7e49106f53211f0e2284ca034d853b9fd76ce89 authored by Dmitry Yu. Naumov on 16 August 2023, 10:57:44 UTC, committed by Dmitry Yu. Naumov on 16 August 2023, 10:57:44 UTC
Fmt and spdlog updates, new formatters See merge request ogs/ogs!4706
CreatePiecewiseLinearCurve.h
/**
* \file
* \copyright
* Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*
* Created on November 11, 2016, 10:49 AM
*/
#pragma once
#include <memory>
#include <vector>
namespace BaseLib
{
class ConfigTree;
}
namespace MathLib
{
struct PiecewiseLinearCurveConfig
{
std::vector<double> xs;
std::vector<double> ys;
};
PiecewiseLinearCurveConfig parsePiecewiseLinearCurveConfig(
BaseLib::ConfigTree const& config);
/// Create a curve
/// \param config ConfigTree object has a tag of `<curve>`
template <typename CurveType>
std::unique_ptr<CurveType> createPiecewiseLinearCurve(
BaseLib::ConfigTree const& config)
{
auto [xs, ys] = parsePiecewiseLinearCurveConfig(config);
return std::make_unique<CurveType>(std::move(xs), std::move(ys));
}
}; // namespace MathLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...