From 6ab98ff337aeeac5ddf8048bfb056c6e7740359c Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Tue, 18 Aug 2015 11:55:08 +0200
Subject: [PATCH] [GL/MaL/MGTL] Using new quicksort version.

---
 GeoLib/Polygon.cpp                                         | 7 ++-----
 .../PiecewiseLinearInterpolation.cpp                       | 4 ++--
 MeshGeoToolsLib/MeshNodesAlongPolyline.cpp                 | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/GeoLib/Polygon.cpp b/GeoLib/Polygon.cpp
index 7c838dc8460..346b4359674 100644
--- a/GeoLib/Polygon.cpp
+++ b/GeoLib/Polygon.cpp
@@ -411,7 +411,8 @@ void Polygon::splitPolygonAtIntersection (std::list<Polygon*>::iterator polygon_
 void Polygon::splitPolygonAtPoint (std::list<GeoLib::Polygon*>::iterator polygon_it)
 {
 	std::size_t n ((*polygon_it)->getNumberOfPoints() - 1), idx0 (0), idx1(0);
-	std::size_t* id_vec (new std::size_t[n]), *perm (new std::size_t[n]);
+	std::vector<std::size_t> id_vec(n);
+	std::vector<std::size_t> perm(n);
 	for (std::size_t k(0); k < n; k++)
 	{
 		id_vec[k] = (*polygon_it)->getPointID (k);
@@ -425,8 +426,6 @@ void Polygon::splitPolygonAtPoint (std::list<GeoLib::Polygon*>::iterator polygon
 		{
 			idx0 = perm[k];
 			idx1 = perm[k + 1];
-			delete [] perm;
-			delete [] id_vec;
 
 			if (idx0 > idx1)
 				std::swap (idx0, idx1);
@@ -456,8 +455,6 @@ void Polygon::splitPolygonAtPoint (std::list<GeoLib::Polygon*>::iterator polygon
 
 			return;
 		}
-	delete [] perm;
-	delete [] id_vec;
 }
 
 GeoLib::Polygon* createPolygonFromCircle (GeoLib::Point const& middle_pnt, double radius,
diff --git a/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp b/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp
index fb4d88b3fb5..dc5c7802b20 100644
--- a/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp
+++ b/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp
@@ -26,7 +26,7 @@ PiecewiseLinearInterpolation::PiecewiseLinearInterpolation(const std::vector<dou
 	_supp_pnts(supporting_points), _values_at_supp_pnts(values_at_supp_pnts)
 {
 	if (!supp_pnts_sorted) {
-		BaseLib::Quicksort<double, double>(_supp_pnts, static_cast<std::size_t> (0),
+		BaseLib::quicksort<double, double>(_supp_pnts, static_cast<std::size_t> (0),
 		                                   _supp_pnts.size(), _values_at_supp_pnts);
 	}
 }
@@ -39,7 +39,7 @@ PiecewiseLinearInterpolation::PiecewiseLinearInterpolation(const std::vector<dou
 	_supp_pnts(supporting_points), _values_at_supp_pnts(values_at_supp_pnts)
 {
 	if (!supp_pnts_sorted) {
-		BaseLib::Quicksort<double, double>(_supp_pnts, static_cast<std::size_t> (0),
+		BaseLib::quicksort<double, double>(_supp_pnts, static_cast<std::size_t> (0),
 		                                   _supp_pnts.size(),
 		                                   _values_at_supp_pnts);
 	}
diff --git a/MeshGeoToolsLib/MeshNodesAlongPolyline.cpp b/MeshGeoToolsLib/MeshNodesAlongPolyline.cpp
index b425eb202a1..8e9500fd53b 100644
--- a/MeshGeoToolsLib/MeshNodesAlongPolyline.cpp
+++ b/MeshGeoToolsLib/MeshNodesAlongPolyline.cpp
@@ -42,7 +42,7 @@ MeshNodesAlongPolyline::MeshNodesAlongPolyline(
 	}
 
 	// sort the nodes along the polyline according to their distances
-	BaseLib::Quicksort<double> (_dist_of_proj_node_from_ply_start, 0,
+	BaseLib::quicksort<double> (_dist_of_proj_node_from_ply_start, 0,
 					_dist_of_proj_node_from_ply_start.size(), _msh_node_ids);
 }
 
-- 
GitLab