From 58ae9c19184f0577e1f5891abfb8c391d17dae41 Mon Sep 17 00:00:00 2001 From: Norihiro Watanabe <norihiro.watanabe@ufz.de> Date: Wed, 28 Jan 2015 13:43:44 +0100 Subject: [PATCH] move dimension constant to Edge,Face,Cell. delete unused --- MeshLib/Elements/Cell.cpp | 2 ++ MeshLib/Elements/Cell.h | 3 ++ MeshLib/Elements/CellRule.cpp | 24 ---------------- MeshLib/Elements/CellRule.h | 31 --------------------- MeshLib/Elements/{FaceRule.cpp => Edge.cpp} | 4 +-- MeshLib/Elements/Edge.h | 3 ++ MeshLib/Elements/Face.cpp | 2 ++ MeshLib/Elements/Face.h | 3 ++ MeshLib/Elements/FaceRule.h | 3 -- MeshLib/Elements/HexRule8.h | 3 +- MeshLib/Elements/PrismRule6.h | 3 +- MeshLib/Elements/PyramidRule5.h | 3 +- MeshLib/Elements/TemplateElement-impl.h | 3 -- MeshLib/Elements/TemplateElement.h | 2 +- MeshLib/Elements/TetRule4.h | 3 +- 15 files changed, 20 insertions(+), 72 deletions(-) delete mode 100644 MeshLib/Elements/CellRule.cpp delete mode 100644 MeshLib/Elements/CellRule.h rename MeshLib/Elements/{FaceRule.cpp => Edge.cpp} (84%) diff --git a/MeshLib/Elements/Cell.cpp b/MeshLib/Elements/Cell.cpp index 02f4d763249..5631fcbaae5 100644 --- a/MeshLib/Elements/Cell.cpp +++ b/MeshLib/Elements/Cell.cpp @@ -20,6 +20,8 @@ namespace MeshLib { +const unsigned Cell::dimension; + Cell::Cell(unsigned value, std::size_t id) : Element(value, id) { diff --git a/MeshLib/Elements/Cell.h b/MeshLib/Elements/Cell.h index fac3a678b8c..66ce7cce3bb 100644 --- a/MeshLib/Elements/Cell.h +++ b/MeshLib/Elements/Cell.h @@ -25,6 +25,9 @@ namespace MeshLib { class Cell : public Element { public: + /// Constant: Dimension of this mesh element + static const unsigned dimension = 3u; + /// Get the volume of this 3d element. virtual double getVolume() const { return getContent(); } diff --git a/MeshLib/Elements/CellRule.cpp b/MeshLib/Elements/CellRule.cpp deleted file mode 100644 index 391b492fa31..00000000000 --- a/MeshLib/Elements/CellRule.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/** - * \copyright - * Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#include "CellRule.h" - -#include "logog/include/logog.hpp" - -#include "GeoLib/AnalyticalGeometry.h" - -#include "MeshLib/Node.h" -#include "Face.h" - -namespace MeshLib -{ - -const unsigned CellRule::dimension; - -} // end namespace MeshLib diff --git a/MeshLib/Elements/CellRule.h b/MeshLib/Elements/CellRule.h deleted file mode 100644 index 82e2af6388a..00000000000 --- a/MeshLib/Elements/CellRule.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * \copyright - * Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#ifndef CELLRULE_H_ -#define CELLRULE_H_ - -#include "MeshLib/MeshEnums.h" -#include "Element.h" - -namespace MeshLib { - -/** - */ -class CellRule -{ -public: - /// Constant: Dimension of this mesh element - static const unsigned dimension = 3u; - -}; /* class */ - -} /* namespace */ - -#endif /* HEXRULE_H_ */ - diff --git a/MeshLib/Elements/FaceRule.cpp b/MeshLib/Elements/Edge.cpp similarity index 84% rename from MeshLib/Elements/FaceRule.cpp rename to MeshLib/Elements/Edge.cpp index fb12a1fded1..93903130acc 100644 --- a/MeshLib/Elements/FaceRule.cpp +++ b/MeshLib/Elements/Edge.cpp @@ -7,11 +7,11 @@ * */ -#include "FaceRule.h" +#include "Edge.h" namespace MeshLib { -const unsigned FaceRule::dimension; +const unsigned Edge::dimension; } /* namespace */ diff --git a/MeshLib/Elements/Edge.h b/MeshLib/Elements/Edge.h index 6a212caf60f..df7eadd129e 100644 --- a/MeshLib/Elements/Edge.h +++ b/MeshLib/Elements/Edge.h @@ -25,6 +25,9 @@ namespace MeshLib { class Edge : public Element { public: + /// Constant: Dimension of this mesh element + static const unsigned dimension = 1u; + /// Get the length of this 1d element. virtual double getLength() const { return _content; } diff --git a/MeshLib/Elements/Face.cpp b/MeshLib/Elements/Face.cpp index 0c5748b9f16..fdeb825d1c5 100644 --- a/MeshLib/Elements/Face.cpp +++ b/MeshLib/Elements/Face.cpp @@ -21,6 +21,8 @@ namespace MeshLib { +const unsigned Face::dimension; + Face::Face(unsigned value, std::size_t id) : Element(value, id) { diff --git a/MeshLib/Elements/Face.h b/MeshLib/Elements/Face.h index e9c006dfc4e..220c561ad7a 100644 --- a/MeshLib/Elements/Face.h +++ b/MeshLib/Elements/Face.h @@ -29,6 +29,9 @@ namespace MeshLib { class Face : public Element { public: + /// Constant: Dimension of this mesh element + static const unsigned dimension = 2u; + /// Get the area of this 2d element. virtual double getArea() const { return _content; } diff --git a/MeshLib/Elements/FaceRule.h b/MeshLib/Elements/FaceRule.h index 5dc7da7971c..273d52c0d57 100644 --- a/MeshLib/Elements/FaceRule.h +++ b/MeshLib/Elements/FaceRule.h @@ -20,9 +20,6 @@ namespace MeshLib { class FaceRule { public: - /// Constant: Dimension of this mesh element - static const unsigned dimension = 2; - /// Returns the face i of the element. static const Element* getFace(const Element* e, unsigned i) { return e->getEdge(i); } diff --git a/MeshLib/Elements/HexRule8.h b/MeshLib/Elements/HexRule8.h index afa16dc8a7a..5bd2646f438 100644 --- a/MeshLib/Elements/HexRule8.h +++ b/MeshLib/Elements/HexRule8.h @@ -12,7 +12,6 @@ #include "MeshLib/MeshEnums.h" #include "Element.h" -#include "CellRule.h" #include "EdgeReturn.h" namespace MeshLib @@ -43,7 +42,7 @@ namespace MeshLib * * @endcode */ -class HexRule8 : public CellRule +class HexRule8 { public: /// Constant: The number of base nodes for this element diff --git a/MeshLib/Elements/PrismRule6.h b/MeshLib/Elements/PrismRule6.h index 7ba50dc0bf1..d75543fba5d 100644 --- a/MeshLib/Elements/PrismRule6.h +++ b/MeshLib/Elements/PrismRule6.h @@ -12,7 +12,6 @@ #include "MeshLib/MeshEnums.h" #include "Element.h" -#include "CellRule.h" #include "EdgeReturn.h" namespace MeshLib @@ -41,7 +40,7 @@ namespace MeshLib * * @endcode */ -class PrismRule6 : public CellRule +class PrismRule6 { public: /// Constant: The number of base nodes for this element diff --git a/MeshLib/Elements/PyramidRule5.h b/MeshLib/Elements/PyramidRule5.h index 3ad691fa79f..c6c8975d50f 100644 --- a/MeshLib/Elements/PyramidRule5.h +++ b/MeshLib/Elements/PyramidRule5.h @@ -12,7 +12,6 @@ #include "MeshLib/MeshEnums.h" #include "Element.h" -#include "CellRule.h" #include "EdgeReturn.h" namespace MeshLib @@ -40,7 +39,7 @@ namespace MeshLib * @endcode */ -class PyramidRule5 : public CellRule +class PyramidRule5 { public: /// Constant: The number of base nodes for this element diff --git a/MeshLib/Elements/TemplateElement-impl.h b/MeshLib/Elements/TemplateElement-impl.h index 58007932e54..a84bf2865b0 100644 --- a/MeshLib/Elements/TemplateElement-impl.h +++ b/MeshLib/Elements/TemplateElement-impl.h @@ -18,9 +18,6 @@ const unsigned TemplateElement<T_BASE, ELEMENT_RULE>::n_all_nodes; template <class T_BASE, class ELEMENT_RULE> const unsigned TemplateElement<T_BASE, ELEMENT_RULE>::n_base_nodes; -template <class T_BASE, class ELEMENT_RULE> -const unsigned TemplateElement<T_BASE, ELEMENT_RULE>::dimension; - template <class T_BASE, class ELEMENT_RULE> TemplateElement<T_BASE, ELEMENT_RULE>::TemplateElement(Node* nodes[n_all_nodes], unsigned value, std::size_t id) : T_BASE(value, id) diff --git a/MeshLib/Elements/TemplateElement.h b/MeshLib/Elements/TemplateElement.h index 9826bdbd8f9..1db5102762d 100644 --- a/MeshLib/Elements/TemplateElement.h +++ b/MeshLib/Elements/TemplateElement.h @@ -39,7 +39,7 @@ public: static const unsigned n_base_nodes = ELEMENT_RULE::n_base_nodes; /// Constant: The dimension of this element - static const unsigned dimension = ELEMENT_RULE::dimension; + using T_BASE::dimension; /** * Constructor with an array of mesh nodes. diff --git a/MeshLib/Elements/TetRule4.h b/MeshLib/Elements/TetRule4.h index eeb3b56c5c4..324eeb4c601 100644 --- a/MeshLib/Elements/TetRule4.h +++ b/MeshLib/Elements/TetRule4.h @@ -12,7 +12,6 @@ #include "MeshLib/MeshEnums.h" #include "Element.h" -#include "CellRule.h" #include "EdgeReturn.h" namespace MeshLib @@ -38,7 +37,7 @@ namespace MeshLib * * @endcode */ -class TetRule4 : public CellRule +class TetRule4 { public: /// Constant: The number of base nodes for this element -- GitLab