From 7956152f005ad1bac145da0b6595f46d31022f80 Mon Sep 17 00:00:00 2001 From: Norihiro Watanabe <norihiro.watanabe@ufz.de> Date: Mon, 27 Apr 2015 11:38:16 +0200 Subject: [PATCH] add CellType2String in MeshEnums --- MeshLib/MeshEnums.cpp | 27 +++++++++++++++++++++++++++ MeshLib/MeshEnums.h | 3 +++ 2 files changed, 30 insertions(+) diff --git a/MeshLib/MeshEnums.cpp b/MeshLib/MeshEnums.cpp index ae06f896459..86b6c4c984e 100644 --- a/MeshLib/MeshEnums.cpp +++ b/MeshLib/MeshEnums.cpp @@ -92,6 +92,33 @@ std::vector<std::string> getMeshElemTypeStringsShort() return vec; } +const std::string CellType2String(const CellType t) +{ +#define RETURN_CELL_TYPE_STR(t, type)\ + if (t == CellType::type)\ + return #type; + + RETURN_CELL_TYPE_STR(t, LINE2); + RETURN_CELL_TYPE_STR(t, LINE3); + RETURN_CELL_TYPE_STR(t, QUAD4); + RETURN_CELL_TYPE_STR(t, QUAD8); + RETURN_CELL_TYPE_STR(t, QUAD9); + RETURN_CELL_TYPE_STR(t, HEX8); + RETURN_CELL_TYPE_STR(t, HEX20); + RETURN_CELL_TYPE_STR(t, HEX27); + RETURN_CELL_TYPE_STR(t, TRI3); + RETURN_CELL_TYPE_STR(t, TRI6); + RETURN_CELL_TYPE_STR(t, TET4); + RETURN_CELL_TYPE_STR(t, TET10); + RETURN_CELL_TYPE_STR(t, PRISM6); + RETURN_CELL_TYPE_STR(t, PRISM15); + RETURN_CELL_TYPE_STR(t, PYRAMID5); + + return "none"; + +#undef RETURN_CELL_TYPE_STR +} + const std::string MeshQualityType2String(const MeshQualityType t) { if (t == MeshQualityType::ELEMENTSIZE) diff --git a/MeshLib/MeshEnums.h b/MeshLib/MeshEnums.h index 35d3c3e6303..b78e9c09955 100644 --- a/MeshLib/MeshEnums.h +++ b/MeshLib/MeshEnums.h @@ -86,6 +86,9 @@ std::vector<MeshElemType> getMeshElemTypes(); /// Returns a vector of strings of mesh element types std::vector<std::string> getMeshElemTypeStringsShort(); +/// Given a MeshElemType this returns the appropriate string. +const std::string CellType2String(const CellType t); + const std::string MeshQualityType2String(const MeshQualityType t); #endif //MESHENUMS_H -- GitLab