From 164b79e4d22d1ee6056cefd07eb580d4ccf6b678 Mon Sep 17 00:00:00 2001 From: Norihiro Watanabe <norihiro.watanabe@ufz.de> Date: Wed, 22 Oct 2014 23:48:33 +0200 Subject: [PATCH] move getElementDimension() to generateStructuredMesh.cpp --- .../generateStructuredMesh.cpp | 28 ++++++++++++++++++- MeshLib/Elements/Element.cpp | 19 ------------- MeshLib/Elements/Element.h | 4 --- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Applications/Utils/SimpleMeshCreation/generateStructuredMesh.cpp b/Applications/Utils/SimpleMeshCreation/generateStructuredMesh.cpp index 35a75789164..7a45a1b4120 100644 --- a/Applications/Utils/SimpleMeshCreation/generateStructuredMesh.cpp +++ b/Applications/Utils/SimpleMeshCreation/generateStructuredMesh.cpp @@ -29,6 +29,32 @@ // FileIO #include "FileIO/Legacy/MeshIO.h" +namespace +{ + +/// Get dimension of the mesh element type. +/// @param eleType element type +unsigned getDimension(MeshElemType eleType) +{ + switch (eleType) + { + case MeshElemType::LINE: + return 1; + case MeshElemType::QUAD: + case MeshElemType::TRIANGLE: + return 2; + case MeshElemType::HEXAHEDRON: + case MeshElemType::PRISM: + case MeshElemType::PYRAMID: + case MeshElemType::TETRAHEDRON: + return 3; + default: + return 0; + } +} + +} // end namespace + int main (int argc, char* argv[]) { @@ -68,7 +94,7 @@ int main (int argc, char* argv[]) cmd.parse(argc, argv); const std::string eleTypeName(eleTypeArg.getValue()); const MeshElemType eleType = String2MeshElemType(eleTypeName); - const unsigned dim = MeshLib::Element::getDimension(eleType); + const unsigned dim = getDimension(eleType); bool dim_used[3] = {false}; for (unsigned i=0; i<dim; i++) diff --git a/MeshLib/Elements/Element.cpp b/MeshLib/Elements/Element.cpp index ef8a581cad2..d2398dc783d 100644 --- a/MeshLib/Elements/Element.cpp +++ b/MeshLib/Elements/Element.cpp @@ -170,23 +170,4 @@ bool Element::isBoundaryElement() const [](MeshLib::Element const*const e){ return e == nullptr; }); } -unsigned Element::getDimension(MeshElemType eleType) -{ - switch (eleType) - { - case MeshElemType::LINE: - return 1; - case MeshElemType::QUAD: - case MeshElemType::TRIANGLE: - return 2; - case MeshElemType::HEXAHEDRON: - case MeshElemType::PRISM: - case MeshElemType::PYRAMID: - case MeshElemType::TETRAHEDRON: - return 3; - default: - return 0; - } -} - } diff --git a/MeshLib/Elements/Element.h b/MeshLib/Elements/Element.h index 6fcd10f43c1..deb21931ee6 100644 --- a/MeshLib/Elements/Element.h +++ b/MeshLib/Elements/Element.h @@ -80,10 +80,6 @@ public: /// Get dimension of the mesh element. virtual unsigned getDimension() const = 0; - /// Get dimension of the mesh element type. - /// @param eleType element type - static unsigned getDimension(MeshElemType eleType); - /// Returns the i-th edge of the element. const Element* getEdge(unsigned i) const; -- GitLab