From 86f05f1b019fec32191f8511ac5bb9964be4105e Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Mon, 19 Jan 2015 14:38:56 +0100 Subject: [PATCH] [MeL] std::size_t instead of unsigned as type for id. Using unique type for id fixes some warnings. --- MeshLib/Node.cpp | 8 ++++---- MeshLib/Node.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MeshLib/Node.cpp b/MeshLib/Node.cpp index 9663fbd538b..8c4d76327db 100644 --- a/MeshLib/Node.cpp +++ b/MeshLib/Node.cpp @@ -17,13 +17,13 @@ namespace MeshLib { -Node::Node(const double coords[3], unsigned id) +Node::Node(const double coords[3], std::size_t id) : MathLib::MathPoint(coords), _id(id) { } -Node::Node(double x, double y, double z, unsigned id) - : MathLib::MathPoint({x, y, z}), _id(id) +Node::Node(double x, double y, double z, std::size_t id) + : MathLib::MathPoint(std::array<double,3>({{x, y, z}})), _id(id) { } @@ -43,7 +43,7 @@ void Node::updateCoordinates(double x, double y, double z) _x[2] = z; const size_t nElements (this->_elements.size()); - for (unsigned i=0; i<nElements; i++) + for (std::size_t i=0; i<nElements; i++) _elements[i]->computeVolume(); } diff --git a/MeshLib/Node.h b/MeshLib/Node.h index e01592681bb..8c74e8ef91e 100644 --- a/MeshLib/Node.h +++ b/MeshLib/Node.h @@ -47,10 +47,10 @@ class Node : public MathLib::MathPoint public: /// Constructor using a coordinate array - Node(const double coords[3], unsigned id = std::numeric_limits<unsigned>::max()); + Node(const double coords[3], std::size_t id = std::numeric_limits<std::size_t>::max()); /// Constructor using single coordinates - Node(double x, double y, double z, unsigned id = std::numeric_limits<unsigned>::max()); + Node(double x, double y, double z, std::size_t id = std::numeric_limits<std::size_t>::max()); /// Copy constructor Node(const Node &node); @@ -61,7 +61,7 @@ public: const std::vector<MeshLib::Node*>& getConnectedNodes() const { return _connected_nodes; } /// Get an element the node is part of. - const Element* getElement(unsigned idx) const { return _elements[idx]; } + const Element* getElement(std::size_t idx) const { return _elements[idx]; } /// Get all elements the node is part of. const std::vector<Element*>& getElements() const { return _elements; } @@ -88,7 +88,7 @@ protected: } /// Sets the ID of a node to the given value. - void setID(unsigned id) { this->_id = id; } + void setID(std::size_t id) { this->_id = id; } /// Update coordinates of a node. /// This method automatically also updates the areas/volumes of all connected elements. -- GitLab