From 7661c0c0eb44da3e3b4d9b333f778ee82ae3b3a7 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Wed, 20 Apr 2016 14:57:14 +0200 Subject: [PATCH] [MaL] Remove unused PiecewiseLinInterp ctor. The constructor performed two things simultaniously, which is not good for a ctor: Constructing the object and calculating the values at given points. If needed such code should be moved to a standalone algorithm. --- .../PiecewiseLinearInterpolation.cpp | 21 ------------------- .../PiecewiseLinearInterpolation.h | 19 +---------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp b/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp index 72ebbbb25f1..595fdd2d9e7 100644 --- a/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp +++ b/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp @@ -34,27 +34,6 @@ PiecewiseLinearInterpolation::PiecewiseLinearInterpolation( } } -PiecewiseLinearInterpolation::PiecewiseLinearInterpolation( - std::vector<double>&& supporting_points, - std::vector<double>&& values_at_supp_pnts, - const std::vector<double>& points_to_interpolate, - std::vector<double>& values_at_interpol_pnts, - bool supp_pnts_sorted) - : _supp_pnts(std::move(supporting_points)), - _values_at_supp_pnts(std::move(values_at_supp_pnts)) -{ - if (!supp_pnts_sorted) { - BaseLib::quicksort<double, double>(_supp_pnts, static_cast<std::size_t> (0), - _supp_pnts.size(), - _values_at_supp_pnts); - } - - values_at_interpol_pnts.resize(points_to_interpolate.size()); - std::transform(points_to_interpolate.begin(), points_to_interpolate.end(), - values_at_interpol_pnts.begin(), - [&](double const& p) { return this->getValue(p); } ); -} - PiecewiseLinearInterpolation::~PiecewiseLinearInterpolation() {} diff --git a/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h b/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h index 5436cdd32de..dbd26340bee 100644 --- a/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h +++ b/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h @@ -47,24 +47,7 @@ public: PiecewiseLinearInterpolation(std::vector<double>&& supporting_points, std::vector<double>&& values_at_supp_pnts, bool supp_pnts_sorted = false); - /** - * The same requirements on the input vectors supporting_points and values_at_supp_pnts - * have to apply as for the previous constructor. - * @param supporting_points vector of supporting points - * @param values_at_supp_pnts vector of values at the supporting points - * @param points_to_interpolate The points should be located within the range - * \f$[x_{\min}, x_{\max}]\f$, where \f$x_{\min} = \min_{1 \le j \le n} x_j\f$ and - * \f$x_{\max} = \max_{1 \le j \le n} x_j\f$. Points outside of this interval are extrapolated. - * @param values_at_interpol_pnts The interpolated values corresponding to the entries - * of the vector points_to_interpolate. - * @param supp_pnts_sorted Is set to false per default. If it is sure that the supporting - * points are sorted one can set the switch to true. - */ - PiecewiseLinearInterpolation(std::vector<double>&& supporting_points, - std::vector<double>&& values_at_supp_pnts, - const std::vector<double>& points_to_interpolate, - std::vector<double>& values_at_interpol_pnts, - bool supp_pnts_sorted = false); + virtual ~PiecewiseLinearInterpolation(); /** -- GitLab