Skip to content
Snippets Groups Projects
Commit 7661c0c0 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[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.
parent 479958f3
No related branches found
No related tags found
No related merge requests found
...@@ -34,27 +34,6 @@ PiecewiseLinearInterpolation::PiecewiseLinearInterpolation( ...@@ -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() PiecewiseLinearInterpolation::~PiecewiseLinearInterpolation()
{} {}
......
...@@ -47,24 +47,7 @@ public: ...@@ -47,24 +47,7 @@ public:
PiecewiseLinearInterpolation(std::vector<double>&& supporting_points, PiecewiseLinearInterpolation(std::vector<double>&& supporting_points,
std::vector<double>&& values_at_supp_pnts, std::vector<double>&& values_at_supp_pnts,
bool supp_pnts_sorted = false); 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(); virtual ~PiecewiseLinearInterpolation();
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment