diff --git a/MeshLib/IO/XDMF/MeshPropertyDataType.cpp b/MeshLib/IO/XDMF/MeshPropertyDataType.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9b84fb063036e3ca4f85f61c027be1acabeba3a1 --- /dev/null +++ b/MeshLib/IO/XDMF/MeshPropertyDataType.cpp @@ -0,0 +1,96 @@ +/** + * \file + * \brief Enum ParentDataType to string translations + * \copyright + * Copyright (c) 2012-2024, 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 "MeshPropertyDataType.h" + +// See https://www.xdmf.org/index.php/XDMF_Model_and_Format#Topology (Arbitrary) +std::string ParentDataType2String(ParentDataType p) +{ + // not used in OGS ParentDataType::POLYGON, ParentDataType::POLYHEDRON, + // ParentDataType::HEXAHEDRON_24 + if (p == ParentDataType::MIXED) + { + return "Mixed"; + } + + if (p == ParentDataType::POLYVERTEX) + { + return "Polyvertex"; + } + if (p == ParentDataType::POLYLINE) + { + return "Polyline"; + } + if (p == ParentDataType::TRIANGLE) + { + return "Triangle"; + } + if (p == ParentDataType::QUADRILATERAL) + { + return "Quadrilateral"; + } + if (p == ParentDataType::TETRAHEDRON) + { + return "Tetrahedron"; + } + if (p == ParentDataType::PYRAMID) + { + return "Pyramid"; + } + if (p == ParentDataType::WEDGE) + { + return "Wedge"; + } + if (p == ParentDataType::HEXAHEDRON) + { + return "Hexahedron"; + } + if (p == ParentDataType::EDGE_3) + { + return "Edge_3"; + } + if (p == ParentDataType::QUADRILATERAL_9) + { + return "Quadrilateral_9"; + } + if (p == ParentDataType::TRIANGLE_6) + { + return "Triangle_6"; + } + if (p == ParentDataType::QUADRILATERAL_8) + { + return "Quadrilateral_8"; + } + if (p == ParentDataType::TETRAHEDRON_10) + { + return "Tetrahedron_10"; + } + if (p == ParentDataType::PYRAMID_13) + { + return "Pyramid_13"; + } + if (p == ParentDataType::WEDGE_15) + { + return "Wedge_15"; + } + if (p == ParentDataType::WEDGE_18) + { + return "Wedge_18"; + } + if (p == ParentDataType::HEXAHEDRON_20) + { + return "Hexahedron_20"; + } + if (p == ParentDataType::HEXAHEDRON_27) + { + return "Hexahedron_27"; + } + return "Mixed"; +} diff --git a/MeshLib/IO/XDMF/MeshPropertyDataType.h b/MeshLib/IO/XDMF/MeshPropertyDataType.h index bee2efdf5044743b12ac5f5eb274a38f60dc3c9a..dc7899dafacd591d0c5773735acd37e1268de304 100644 --- a/MeshLib/IO/XDMF/MeshPropertyDataType.h +++ b/MeshLib/IO/XDMF/MeshPropertyDataType.h @@ -2,7 +2,7 @@ * \file * \author Tobias Meisel * \date 2020-12-15 - * \brief Enum for all propertyVector data types + * \brief Enum for all propertyVector data types and XDMF ParentDataTypes * \copyright * Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org) * Distributed under a Modified BSD License. @@ -12,6 +12,8 @@ #pragma once +#include <string> + // TODO (tm) If used on several other places move definition of propertyVector enum class MeshPropertyDataType { @@ -29,12 +31,33 @@ enum class MeshPropertyDataType enum_length }; - -// See https://www.xdmf.org/index.php/XDMF_Model_and_Format - only relevant of +// See https://www.xdmf.org/index.php/XDMF_Model_and_Format - only relevant if // TopologyType(s) added, structure is open to be extended with GridType(s) // and ItemType(s). enum class ParentDataType { - Polyvertex=0, - Mixed, -}; \ No newline at end of file + MIXED = 0, + POLYVERTEX = 1, + POLYLINE = 2, + // POLYGON = 3, // not used in OGS + TRIANGLE = 4, + QUADRILATERAL = 5, + TETRAHEDRON = 6, + PYRAMID = 7, + WEDGE = 8, + HEXAHEDRON = 9, + // POLYHEDRON = 16, // not used in OGS + EDGE_3 = 34, + QUADRILATERAL_9 = 35, + TRIANGLE_6 = 36, + QUADRILATERAL_8 = 37, + TETRAHEDRON_10 = 38, + PYRAMID_13 = 39, + WEDGE_15 = 40, + WEDGE_18 = 41, + HEXAHEDRON_20 = 48, + // HEXAHEDRON_24 = 49, // not used in OGS + HEXAHEDRON_27 = 50 +}; + +std::string ParentDataType2String(ParentDataType p);