From 873195ad3ab42ea04c57435b0c05dfcf21b9a7d8 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Mon, 15 Oct 2018 18:53:35 +0200 Subject: [PATCH] Add comprehensive name function for CellType --- src/mesh/CellType.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mesh/CellType.hpp b/src/mesh/CellType.hpp index 05bd8320e..586421006 100644 --- a/src/mesh/CellType.hpp +++ b/src/mesh/CellType.hpp @@ -1,6 +1,9 @@ #ifndef CELL_TYPE_HPP #define CELL_TYPE_HPP +#include <PastisMacros.hpp> +#include <string_view> + enum class CellType : unsigned short { Line = 0, @@ -14,6 +17,18 @@ enum class CellType : unsigned short Hexahedron }; - +PASTIS_INLINE +std::string_view name(const CellType& cell_type) +{ + switch (cell_type) { + case CellType::Line: return "line"; + case CellType::Triangle: return "triangle"; + case CellType::Quadrangle: return "quadrangle"; + case CellType::Tetrahedron: return "tetrahedron"; + case CellType::Pyramid: return "pyramid"; + case CellType::Prism: return "prism"; + case CellType::Hexahedron: return "hexahedron"; + } +} #endif // CELL_TYPE_HPP -- GitLab