From 579ce8091f909f865fc483eff09c0b1e74f60979 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Mon, 19 Jan 2015 09:54:53 +0100
Subject: [PATCH] [MeL] Node: New base class MathPoint.

Changed the base class from PointWithID to MathPoint. Also introduced a
std::size_t _id for the id of the Node.

This change saves 8 bytes per MeshLib::Node because the Node is not anymore a GeoObject.
---
 MeshLib/Node.cpp | 6 +++---
 MeshLib/Node.h   | 7 +++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/MeshLib/Node.cpp b/MeshLib/Node.cpp
index a6878753a90..9663fbd538b 100644
--- a/MeshLib/Node.cpp
+++ b/MeshLib/Node.cpp
@@ -18,17 +18,17 @@
 namespace MeshLib {
 
 Node::Node(const double coords[3], unsigned id)
-	: GeoLib::PointWithID(coords, id)
+	: MathLib::MathPoint(coords), _id(id)
 {
 }
 
 Node::Node(double x, double y, double z, unsigned id)
-	: GeoLib::PointWithID(x, y, z, id)
+	: MathLib::MathPoint({x, y, z}), _id(id)
 {
 }
 
 Node::Node(const Node &node)
-	: GeoLib::PointWithID(node.getCoords(), node.getID())
+	: MathLib::MathPoint(node.getCoords()), _id(node.getID())
 {
 }
 
diff --git a/MeshLib/Node.h b/MeshLib/Node.h
index 96f250bc01c..e01592681bb 100644
--- a/MeshLib/Node.h
+++ b/MeshLib/Node.h
@@ -20,7 +20,7 @@
 #include <set>
 #include <vector>
 
-#include "GeoLib/PointWithID.h"
+#include "MathLib/MathPoint.h"
 
 #include "MeshEditing/removeMeshNodes.h"
 #include "MeshGenerators/MeshLayerMapper.h"
@@ -35,7 +35,7 @@ class Element;
 /**
  * A mesh node with coordinates in 3D space.
  */
-class Node : public GeoLib::PointWithID
+class Node : public MathLib::MathPoint
 {
 	/* friend functions: */
 	friend bool MeshLayerMapper::layerMapping(MeshLib::Mesh &mesh, const GeoLib::Raster &raster, double noDataReplacementValue);
@@ -55,6 +55,8 @@ public:
 	/// Copy constructor
 	Node(const Node &node);
 
+	std::size_t getID() const { return _id; }
+
 	/// Return all the nodes connected to this one
 	const std::vector<MeshLib::Node*>& getConnectedNodes() const { return _connected_nodes; }
 
@@ -92,6 +94,7 @@ protected:
 	/// This method automatically also updates the areas/volumes of all connected elements.
 	virtual void updateCoordinates(double x, double y, double z);
 
+	std::size_t _id;
 	std::vector<Node*> _connected_nodes;
 	std::vector<Element*> _elements;
 }; /* class */
-- 
GitLab