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

Pass r-values to PiecewiseLinearInterpolation ctor.

parent ca5ffd24
No related branches found
No related tags found
No related merge requests found
...@@ -359,8 +359,8 @@ void ProjectData::parseNonlinearSolvers(BaseLib::ConfigTree const& config) ...@@ -359,8 +359,8 @@ void ProjectData::parseNonlinearSolvers(BaseLib::ConfigTree const& config)
static std::unique_ptr<MathLib::PiecewiseLinearInterpolation> static std::unique_ptr<MathLib::PiecewiseLinearInterpolation>
createPiecewiseLinearInterpolation(BaseLib::ConfigTree const& config) createPiecewiseLinearInterpolation(BaseLib::ConfigTree const& config)
{ {
auto const coords = config.getConfParam<std::vector<double>>("coords"); auto coords = config.getConfParam<std::vector<double>>("coords");
auto const values = config.getConfParam<std::vector<double>>("values"); auto values = config.getConfParam<std::vector<double>>("values");
if (coords.empty() || values.empty()) if (coords.empty() || values.empty())
{ {
ERR("The given co-ordinates or values vector is empty."); ERR("The given co-ordinates or values vector is empty.");
...@@ -373,7 +373,8 @@ createPiecewiseLinearInterpolation(BaseLib::ConfigTree const& config) ...@@ -373,7 +373,8 @@ createPiecewiseLinearInterpolation(BaseLib::ConfigTree const& config)
} }
return std::unique_ptr<MathLib::PiecewiseLinearInterpolation>{ return std::unique_ptr<MathLib::PiecewiseLinearInterpolation>{
new MathLib::PiecewiseLinearInterpolation{coords, values}}; new MathLib::PiecewiseLinearInterpolation{std::move(coords),
std::move(values)}};
} }
void ProjectData::parseCurves( void ProjectData::parseCurves(
......
...@@ -55,7 +55,8 @@ MathLib::PiecewiseLinearInterpolation LinearInterpolationAlongPolyline::createIn ...@@ -55,7 +55,8 @@ MathLib::PiecewiseLinearInterpolation LinearInterpolationAlongPolyline::createIn
} }
} }
return MathLib::PiecewiseLinearInterpolation(vec_known_dist, vec_known_values); return MathLib::PiecewiseLinearInterpolation{std::move(vec_known_dist),
std::move(vec_known_values)};
} }
double LinearInterpolationAlongPolyline::operator()(const MathLib::Point3d& pnt) const double LinearInterpolationAlongPolyline::operator()(const MathLib::Point3d& pnt) const
......
...@@ -32,7 +32,8 @@ TEST(MathLibInterpolationAlgorithms, PiecewiseLinearInterpolation) ...@@ -32,7 +32,8 @@ TEST(MathLibInterpolationAlgorithms, PiecewiseLinearInterpolation)
} }
} }
MathLib::PiecewiseLinearInterpolation interpolation(supp_pnts, values); MathLib::PiecewiseLinearInterpolation interpolation{std::move(supp_pnts),
std::move(values)};
// Interpolation // Interpolation
for (std::size_t k(0); k<size-1; ++k) { for (std::size_t k(0); k<size-1; ++k) {
ASSERT_NEAR(0.5, interpolation.getValue(k+0.5), std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.5, interpolation.getValue(k+0.5), std::numeric_limits<double>::epsilon());
...@@ -67,7 +68,8 @@ TEST(MathLibInterpolationAlgorithms, PiecewiseLinearInterpolationSupportPntsInRe ...@@ -67,7 +68,8 @@ TEST(MathLibInterpolationAlgorithms, PiecewiseLinearInterpolationSupportPntsInRe
} }
} }
MathLib::PiecewiseLinearInterpolation interpolation(supp_pnts, values); MathLib::PiecewiseLinearInterpolation interpolation{std::move(supp_pnts),
std::move(values)};
// Interpolation // Interpolation
for (std::size_t k(0); k<size-1; ++k) { for (std::size_t k(0); k<size-1; ++k) {
ASSERT_NEAR(0.5, interpolation.getValue(k+0.5), std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.5, interpolation.getValue(k+0.5), std::numeric_limits<double>::epsilon());
......
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