Skip to content
Snippets Groups Projects
Commit 579ce809 authored by Tom Fischer's avatar Tom Fischer
Browse files

[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.
parent 8fa5cc91
No related branches found
No related tags found
No related merge requests found
...@@ -18,17 +18,17 @@ ...@@ -18,17 +18,17 @@
namespace MeshLib { namespace MeshLib {
Node::Node(const double coords[3], unsigned id) 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) 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) Node::Node(const Node &node)
: GeoLib::PointWithID(node.getCoords(), node.getID()) : MathLib::MathPoint(node.getCoords()), _id(node.getID())
{ {
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include "GeoLib/PointWithID.h" #include "MathLib/MathPoint.h"
#include "MeshEditing/removeMeshNodes.h" #include "MeshEditing/removeMeshNodes.h"
#include "MeshGenerators/MeshLayerMapper.h" #include "MeshGenerators/MeshLayerMapper.h"
...@@ -35,7 +35,7 @@ class Element; ...@@ -35,7 +35,7 @@ class Element;
/** /**
* A mesh node with coordinates in 3D space. * A mesh node with coordinates in 3D space.
*/ */
class Node : public GeoLib::PointWithID class Node : public MathLib::MathPoint
{ {
/* friend functions: */ /* friend functions: */
friend bool MeshLayerMapper::layerMapping(MeshLib::Mesh &mesh, const GeoLib::Raster &raster, double noDataReplacementValue); friend bool MeshLayerMapper::layerMapping(MeshLib::Mesh &mesh, const GeoLib::Raster &raster, double noDataReplacementValue);
...@@ -55,6 +55,8 @@ public: ...@@ -55,6 +55,8 @@ public:
/// Copy constructor /// Copy constructor
Node(const Node &node); Node(const Node &node);
std::size_t getID() const { return _id; }
/// Return all the nodes connected to this one /// Return all the nodes connected to this one
const std::vector<MeshLib::Node*>& getConnectedNodes() const { return _connected_nodes; } const std::vector<MeshLib::Node*>& getConnectedNodes() const { return _connected_nodes; }
...@@ -92,6 +94,7 @@ protected: ...@@ -92,6 +94,7 @@ protected:
/// This method automatically also updates the areas/volumes of all connected elements. /// This method automatically also updates the areas/volumes of all connected elements.
virtual void updateCoordinates(double x, double y, double z); virtual void updateCoordinates(double x, double y, double z);
std::size_t _id;
std::vector<Node*> _connected_nodes; std::vector<Node*> _connected_nodes;
std::vector<Element*> _elements; std::vector<Element*> _elements;
}; /* class */ }; /* class */
......
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