OGS
MeshEnums.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <string>
7#include <vector>
8
9namespace MeshLib
10{
11
20
22static constexpr char const* mesh_item_type_strings[] = {
23 "node", "edge", "face", "cell", "integration_point"};
24
26static constexpr char const* toString(const MeshItemType t)
27{
28 return mesh_item_type_strings[static_cast<int>(t)];
29}
30
33MeshItemType string2MeshItemType(const std::string& s);
34
35std::ostream& operator<<(std::ostream& os, MeshItemType const& t);
36
41enum class MeshElemType
42{
44 POINT = 1,
45 LINE = 3,
46 QUAD = 9,
50 PRISM = 16,
52};
53
57enum class CellType
58{
60 POINT1 = 1,
61 LINE2 = 2,
62 LINE3 = 3,
63 TRI3 = 4,
64 TRI6 = 5,
65 QUAD4 = 6,
66 QUAD8 = 7,
67 QUAD9 = 8,
68 TET4 = 9,
69 TET10 = 10,
70 HEX8 = 11,
71 HEX20 = 12,
72 HEX27 = 13,
73 PRISM6 = 14,
74 PRISM15 = 15,
75 PRISM18 = 16,
79};
80
93
104
106std::string MeshElemType2String(const MeshElemType t);
107
109std::string MeshElemType2StringShort(const MeshElemType t);
110
113MeshElemType String2MeshElemType(const std::string& s);
114
116std::vector<MeshElemType> getMeshElemTypes();
117
119std::vector<std::string> getMeshElemTypeStringsShort();
120
122constexpr unsigned getDimension(MeshElemType t)
123{
124 switch (t)
125 {
127 return 1;
130 return 2;
135 return 3;
138 return 0;
139 }
140 return 0;
141}
142
144std::string CellType2String(const CellType t);
145
146std::string MeshQualityType2String(const MeshQualityType t);
148
149} // namespace MeshLib
MeshElemType String2MeshElemType(const std::string &s)
Definition MeshEnums.cpp:86
CellType
Types of mesh elements supported by OpenGeoSys.
Definition MeshEnums.h:58
static constexpr char const * mesh_item_type_strings[]
Char array names for all of MeshItemType values.
Definition MeshEnums.h:22
MeshLib::MeshQualityType String2MeshQualityType(std::string const &s)
std::string MeshElemType2String(const MeshElemType t)
Given a MeshElemType this returns the appropriate string.
Definition MeshEnums.cpp:12
MeshQualityType
Describes a mesh quality metric.
Definition MeshEnums.h:85
std::vector< MeshElemType > getMeshElemTypes()
Returns a vector of all mesh element types.
std::string MeshElemType2StringShort(const MeshElemType t)
Given a MeshElemType this returns the appropriate string with a short name.
Definition MeshEnums.cpp:49
std::vector< std::string > getMeshElemTypeStringsShort()
Returns a vector of strings of mesh element types.
std::string CellType2String(const CellType t)
Given a MeshElemType this returns the appropriate string.
std::string MeshQualityType2String(const MeshQualityType t)
constexpr unsigned getDimension(MeshElemType t)
Returns the dimension of the given MeshElemType.
Definition MeshEnums.h:122
std::ostream & operator<<(std::ostream &os, Element const &e)
Definition Element.cpp:97
UseIntensityAs
Selection of possible interpretations for intensities.
Definition MeshEnums.h:98
static constexpr char const * toString(const MeshItemType t)
Returns a char array for a specific MeshItemType.
Definition MeshEnums.h:26
MeshElemType
Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum.
Definition MeshEnums.h:42
MeshItemType string2MeshItemType(const std::string &s)