From 2c7e82d87e702ab39ba9d9363673a69e29558c55 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Mon, 18 May 2015 08:29:50 +0200
Subject: [PATCH] [T/FileIO/GL] Substituting PointWithID with Point.

---
 FileIO/TetGenInterface.cpp |  8 +-------
 FileIO/TetGenInterface.h   |  6 ++++--
 GeoLib/PointVec.cpp        |  3 +--
 GeoLib/PointVec.h          |  4 +---
 Tests/GeoLib/TestGrid.cpp  | 19 ++++++++++---------
 5 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/FileIO/TetGenInterface.cpp b/FileIO/TetGenInterface.cpp
index 329fe60ad1b..536117bdd0f 100644
--- a/FileIO/TetGenInterface.cpp
+++ b/FileIO/TetGenInterface.cpp
@@ -26,12 +26,6 @@
 // FileIO
 #include "TetGenInterface.h"
 
-// GeoLib
-#include "GeoLib/PointWithID.h"
-
-// MathLib
-#include "TemplatePoint.h"
-
 // MeshLib
 #include "Mesh.h"
 #include "MeshLib/Node.h"
@@ -502,7 +496,7 @@ bool TetGenInterface::parseElements(std::ifstream& ins,
 bool TetGenInterface::writeTetGenSmesh(const std::string &file_name,
                                        const GeoLib::GEOObjects &geo_objects,
                                        const std::string &geo_name,
-                                       const std::vector<GeoLib::PointWithID> &attribute_points) const
+                                       const std::vector<GeoLib::Point> &attribute_points) const
 {
 	std::vector<GeoLib::Point*> const*const points = geo_objects.getPointVec(geo_name);
 	std::vector<GeoLib::Surface*> const*const surfaces = geo_objects.getSurfaceVec(geo_name);
diff --git a/FileIO/TetGenInterface.h b/FileIO/TetGenInterface.h
index 45431769aac..b6548d3699c 100644
--- a/FileIO/TetGenInterface.h
+++ b/FileIO/TetGenInterface.h
@@ -17,7 +17,9 @@
 
 #include <vector>
 
-#include "GEOObjects.h"
+// GeoLib
+#include "GeoLib/Point.h"
+#include "GeoLib/GEOObjects.h"
 
 // forward declaration of class Node and Element
 namespace MeshLib
@@ -71,7 +73,7 @@ public:
 	bool writeTetGenSmesh(const std::string &file_name,
 	                      const GeoLib::GEOObjects &geo_objects,
 	                      const std::string &geo_name,
-	                      const std::vector<GeoLib::PointWithID> &attribute_points) const;
+	                      const std::vector<GeoLib::Point> &attribute_points) const;
 
 	/**
 	 * Writes the geometry of a given name to TetGen smesh-file.
diff --git a/GeoLib/PointVec.cpp b/GeoLib/PointVec.cpp
index 727d194dffd..dab41d47257 100644
--- a/GeoLib/PointVec.cpp
+++ b/GeoLib/PointVec.cpp
@@ -19,7 +19,6 @@
 
 // GeoLib
 #include "PointVec.h"
-#include "PointWithID.h"
 
 // BaseLib
 #include "quicksort.h"
@@ -214,7 +213,7 @@ std::vector<GeoLib::Point*>* PointVec::getSubset(const std::vector<std::size_t>
 
 	const std::size_t nPoints(subset.size());
 	for (std::size_t i = 0; i < nPoints; i++)
-		(*new_points)[i] = new GeoLib::PointWithID((*this->_data_vec)[subset[i]]->getCoords(), subset[i]);
+		(*new_points)[i] = new GeoLib::Point(*(*this->_data_vec)[subset[i]]);
 
 	return new_points;
 }
diff --git a/GeoLib/PointVec.h b/GeoLib/PointVec.h
index 95f471aa267..d768d252850 100644
--- a/GeoLib/PointVec.h
+++ b/GeoLib/PointVec.h
@@ -29,8 +29,6 @@
 namespace GeoLib
 {
 
-class PointWithID;
-
 /**
  * \ingroup GeoLib
  *
@@ -102,7 +100,7 @@ public:
 
 	const GeoLib::AABB<GeoLib::Point>& getAABB () const;
 
-	/// Returns a subset of this point vector containing only the points specified in "subset" as PointWithID-objects
+	/// Returns a subset of this point vector containing only the points specified in "subset"
 	std::vector<GeoLib::Point*>* getSubset(const std::vector<std::size_t> &subset) const;
 
 private:
diff --git a/Tests/GeoLib/TestGrid.cpp b/Tests/GeoLib/TestGrid.cpp
index d2f8a77b2c2..44a31879297 100644
--- a/Tests/GeoLib/TestGrid.cpp
+++ b/Tests/GeoLib/TestGrid.cpp
@@ -16,7 +16,6 @@
 #include "gtest/gtest.h"
 
 #include "GeoLib/Point.h"
-#include "GeoLib/PointWithID.h"
 #include "GeoLib/Grid.h"
 
 #include "MathTools.h"
@@ -95,7 +94,7 @@ TEST(GeoLib, SearchNearestPointInGrid)
 TEST(GeoLib, SearchNearestPointsInDenseGrid)
 {
 	const std::size_t i_max(50), j_max(50), k_max(50);
-	std::vector<GeoLib::PointWithID*> pnts(i_max*j_max*k_max);
+	std::vector<GeoLib::Point*> pnts(i_max*j_max*k_max);
 
 	// fill the vector with equi-distant points in the
 	// cube [0,(i_max-1)/i_max] x [0,(j_max-1)/j_max] x [0,(k_max-1)/k_max]
@@ -104,19 +103,21 @@ TEST(GeoLib, SearchNearestPointsInDenseGrid)
 		for (std::size_t j(0); j < j_max; j++) {
 			std::size_t offset1(j * k_max + offset0);
 			for (std::size_t k(0); k < k_max; k++) {
-				pnts[offset1 + k] = new GeoLib::PointWithID(static_cast<double>(i) / i_max,
-						static_cast<double>(j) / j_max, static_cast<double>(k) / k_max, offset1+k);
+				pnts[offset1 + k] = new GeoLib::Point(
+					std::array<double,3>({{static_cast<double>(i) / i_max,
+						static_cast<double>(j) / j_max,
+						static_cast<double>(k) / k_max}}), offset1+k);
 			}
 		}
 	}
 
 	// create the grid
-	GeoLib::Grid<GeoLib::PointWithID>* grid(nullptr);
-	ASSERT_NO_THROW(grid = new GeoLib::Grid<GeoLib::PointWithID> (pnts.begin(), pnts.end()));
+	GeoLib::Grid<GeoLib::Point>* grid(nullptr);
+	ASSERT_NO_THROW(grid = new GeoLib::Grid<GeoLib::Point> (pnts.begin(), pnts.end()));
 
 	// search point (1,1,1) is outside of the point set
-	GeoLib::PointWithID search_pnt(1,1,1, 0);
-	GeoLib::PointWithID* res(grid->getNearestPoint(search_pnt.getCoords()));
+	GeoLib::Point search_pnt(std::array<double,3>({{1,1,1}}), 0);
+	GeoLib::Point* res(grid->getNearestPoint(search_pnt.getCoords()));
 	ASSERT_EQ(res->getID(), i_max*j_max*k_max-1);
 	ASSERT_NEAR(sqrt(MathLib::sqrDist(*res, search_pnt)), sqrt(3.0)/50.0, std::numeric_limits<double>::epsilon());
 
@@ -145,5 +146,5 @@ TEST(GeoLib, SearchNearestPointsInDenseGrid)
 	}
 
 	delete grid;
-	std::for_each(pnts.begin(), pnts.end(), std::default_delete<GeoLib::PointWithID>());
+	std::for_each(pnts.begin(), pnts.end(), std::default_delete<GeoLib::Point>());
 }
-- 
GitLab