diff --git a/GeoLib/Point.cpp b/GeoLib/Point.cpp index 14a1cf12c98ab6eff242440189955b3c026a0827..8032f2dc4d87e8fdb89f695313e9c951ef47a91a 100644 --- a/GeoLib/Point.cpp +++ b/GeoLib/Point.cpp @@ -16,26 +16,6 @@ #include "Point.h" -bool operator<= (const GeoLib::Point& p0, const GeoLib::Point& p1) -{ - double tol (sqrt (std::numeric_limits<double>::min())); - - if (fabs (p0[0]-p1[0]) > tol * fabs(p0[0])) { - if (p0[0] < p1[0]) return true; - else return false; - } else { - // assume p0[0] == p1[0] - if (fabs (p0[1]-p1[1]) > tol * fabs(p0[1])) { - if (p0[1] < p1[1]) return true; - else return false; - } else { - // assume p0[1] == p1[1] and p0[0] == p1[0] - if (p0[2] < p1[2]) return true; - else return false; - } - } -} - namespace GeoLib { bool lessX (GeoLib::Point const & p0, GeoLib::Point const & p1) @@ -56,5 +36,24 @@ bool lessZ (GeoLib::Point const & p0, GeoLib::Point const & p1) return false; } +bool operator<= (const GeoLib::Point& p0, const GeoLib::Point& p1) +{ + double tol (sqrt (std::numeric_limits<double>::min())); + + if (fabs (p0[0]-p1[0]) > tol * fabs(p0[0])) { + if (p0[0] < p1[0]) return true; + else return false; + } else { + // assume p0[0] == p1[0] + if (fabs (p0[1]-p1[1]) > tol * fabs(p0[1])) { + if (p0[1] < p1[1]) return true; + else return false; + } else { + // assume p0[1] == p1[1] and p0[0] == p1[0] + if (p0[2] < p1[2]) return true; + else return false; + } + } +} } // end namespace GeoLib diff --git a/GeoLib/Point.h b/GeoLib/Point.h index 56993e1887a8e414e06cae0d0eafa8b1b7c4db87..8f8911fbeeead48ec2f2ce713bc2d3d4d22f07fb 100644 --- a/GeoLib/Point.h +++ b/GeoLib/Point.h @@ -47,11 +47,11 @@ bool lessY (Point const & p0, Point const & p1); */ bool lessZ (Point const & p0, Point const & p1); -} - /** * lexicographic comparison of points */ bool operator<= (GeoLib::Point const & p0, GeoLib::Point const & p1); +} + #endif /* POINT_H_ */ diff --git a/MeshLib/Elements/Edge.h b/MeshLib/Elements/Edge.h index de64e973daf75c73ef9f1dcb7790aa6418074f7a..dcb0898e5ab2435b4c0d80dc435a54287d671d53 100644 --- a/MeshLib/Elements/Edge.h +++ b/MeshLib/Elements/Edge.h @@ -13,6 +13,8 @@ #ifndef EDGE_H_ #define EDGE_H_ +#include <limits> + #include "Element.h" namespace MeshLib { @@ -84,7 +86,7 @@ public: virtual Element* reviseElement() const; protected: - double Edge::computeVolume(); + double computeVolume(); /// 1D elements have no edges. Node const* getEdgeNode(unsigned edge_id, unsigned node_id) const { (void)edge_id; (void)node_id; return NULL; }; @@ -92,7 +94,7 @@ protected: Node* getFaceNode(unsigned face_id, unsigned node_id) const { (void)face_id; (void)node_id; return NULL; }; /// Returns the ID of a face given an array of nodes (but is not applicable for edges!). - unsigned identifyFace(Node* nodes[3]) const { return std::numeric_limits<unsigned>::max(); }; + unsigned identifyFace(Node* [3]/*nodes[3]*/) const { return std::numeric_limits<unsigned>::max(); }; double _length; diff --git a/MeshLib/Elements/Element.cpp b/MeshLib/Elements/Element.cpp index a79197aba5146d13f4e1cab9af8b0f1ba02aee7d..bf356f8ccca68fb418dacb8dd10359b2ff4b57a6 100644 --- a/MeshLib/Elements/Element.cpp +++ b/MeshLib/Elements/Element.cpp @@ -39,7 +39,6 @@ bool Element::addNeighbor(Element* e) if (e == this) return false; - unsigned n(0); unsigned nNeighbors (this->getNNeighbors()); for (unsigned n=0; n<nNeighbors; n++) { diff --git a/MeshLib/MshEditor.cpp b/MeshLib/MshEditor.cpp index 7a9de2c2c1d601fb73c1143c7591d716380fb27f..bad87b43686c0e43c8fd0e645acff7542a58c838 100644 --- a/MeshLib/MshEditor.cpp +++ b/MeshLib/MshEditor.cpp @@ -21,6 +21,7 @@ #include "MathTools.h" +namespace MeshLib { void MshEditor::getSurfaceAreaForNodes(const MeshLib::Mesh* mesh, std::vector<double> &node_area_vec) { @@ -153,7 +154,7 @@ MeshLib::Mesh* MshEditor::getMeshSurface(const MeshLib::Mesh &mesh, const double const std::vector<MeshLib::Element*> elements = mesh.getElements(); std::vector<MeshLib::Element*> new_elements; const size_t nElements (mesh.getNElements()); - + bool complete_surface = ((dir[0]*dir[0] + dir[1]*dir[1] + dir[2]*dir[2]) == 0) ? true : false; // 2D meshes @@ -173,7 +174,7 @@ MeshLib::Mesh* MshEditor::getMeshSurface(const MeshLib::Mesh &mesh, const double } } // 3D meshes - else if (mesh.getDimension() == 3) // + else if (mesh.getDimension() == 3) // { for (unsigned i=0; i<nElements; i++) { @@ -227,4 +228,4 @@ MeshLib::Mesh* MshEditor::getMeshSurface(const MeshLib::Mesh &mesh, const double } - +} // end namespace MeshLib diff --git a/MeshLib/MshEditor.h b/MeshLib/MshEditor.h index ef9892289f1b3d350a70ab3b947058bc5809e340..083daba110d2d5adda8bce44b15a9f149e5e4dee 100644 --- a/MeshLib/MshEditor.h +++ b/MeshLib/MshEditor.h @@ -22,9 +22,9 @@ namespace GeoLib { } namespace MeshLib { - class Mesh; - class Element; -} +// forward declarations +class Mesh; +class Element; /** * \brief A set of tools for manipulating existing meshes @@ -39,15 +39,17 @@ public: static void getSurfaceAreaForNodes(const MeshLib::Mesh* mesh, std::vector<double> &node_area_vec); /// Removes the mesh nodes (and connected elements) given in the nodes-list from the mesh. - static MeshLib::Mesh* removeMeshNodes(MeshLib::Mesh* mesh, const std::vector<size_t> &nodes); + MeshLib::Mesh* removeMeshNodes(MeshLib::Mesh* mesh, const std::vector<size_t> &nodes); /// Returns the surface nodes of a layered mesh. static std::vector<GeoLib::PointWithID*> getSurfaceNodes(const MeshLib::Mesh &mesh); - /// Returns the 2d-element mesh representing the surface of the given layered mesh. + /// Returns the 2d-element mesh representing the surface of the given layered mesh. static MeshLib::Mesh* getMeshSurface(const MeshLib::Mesh &mesh, const double* dir); private: }; +} // end namespace MeshLib + #endif //MSHEDITOR_H