LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
gmsh_file_v2.h
1
10#ifndef __1fd687af60b74bf6aad50d509ecbc4da
11#define __1fd687af60b74bf6aad50d509ecbc4da
12
13#include <lf/mesh/mesh.h>
14
15namespace lf::io {
16
18struct GMshFileV2 {
21 std::string VersionNumber;
23 bool IsBinary = false;
25 int DoubleSize = 64;
26
43 int Dimension = 0;
46
52 int Number = 0;
54 std::string Name;
55 };
56
62 std::vector<PhysicalEntity> PhysicalEntities;
63
72 std::vector<std::pair<size_type, Eigen::Vector3d>> Nodes;
73
75 enum class ElementType : int {
76 EDGE2 = 1,
77 TRIA3 = 2,
78 QUAD4 = 3,
79 TET4 = 4,
80 HEX8 = 5,
81 PRISM6 = 6,
82 PYRAMID5 = 7,
83 EDGE3 = 8,
85 TRIA6 = 9,
87 QUAD9 = 10,
89 TET10 = 11,
91 HEX27 = 12,
94 PRISM18 =
95 13,
97 PYRAMID14 =
98 14,
100 POINT = 15,
101 QUAD8 = 16,
103 HEX20 = 17,
105 PRISM15 = 18,
107 PYRAMID13 = 19,
109 TRIA9 = 20,
111 TRIA10 = 21,
113 TRIA12 = 22,
115 TRIA15 = 23,
117 TRIA15_5 = 24,
119 TRIA21 = 25,
121 EDGE4 = 26,
123 EDGE5 = 27,
125 EDGE6 = 28,
127 TET20 = 29,
129 TET35 = 30,
132 TET56 = 31,
135 HEX64 = 92,
138 HEX125 = 93
141 };
142
144 static const std::vector<ElementType> AllElementTypes;
145
151 struct Element {
172
179 std::vector<int> MeshPartitions;
180
186 std::vector<size_type> NodeNumbers;
187 };
188
196 std::vector<Element> Elements;
197
209 int Dimension = 0;
223 std::vector<std::pair<size_type, size_type>> NodeMapping;
224 };
225
228 std::vector<PeriodicEntity> Periodic;
229};
230
232std::ostream& operator<<(std::ostream& stream, const GMshFileV2& mf);
233
235std::ostream& operator<<(std::ostream& stream, GMshFileV2::ElementType et);
236
238unsigned int NumNodes(GMshFileV2::ElementType et);
239
242
245
262GMshFileV2 readGmshFileV2(std::string::const_iterator begin,
263 std::string::const_iterator end,
264 const std::string& version, bool is_binary,
265 int size_t_size, int one,
266 const std::string& filename);
267
268} // namespace lf::io
269
270#endif // __1fd687af60b74bf6aad50d509ecbc4da
Represents a reference element with all its properties.
Definition: ref_el.h:106
lf::base::size_type size_type
Mesh input (from file) and output (in various formats) facilities.
Definition: gmsh_file_v2.cc:35
GMshFileV2 readGmshFileV2(std::string::const_iterator begin, std::string::const_iterator end, const std::string &version, bool is_binary, int size_t_size, int one, const std::string &filename)
Read a *.msh file from disk and copy it's contents into the MshFile Datastructure.
int DimOf(GMshFileV2::ElementType et)
Dimension of the GmshElement type.
base::RefEl RefElOf(GMshFileV2::ElementType et)
Reference element type of a GmshElementType.
std::ostream & operator<<(std::ostream &stream, GMshFileV2::ElementType et)
Output the element type onto the console:
Definition: gmsh_file_v2.cc:38
size_type NumNodes(GMshFileV2::ElementType et)
Number of nodes that this element type has.
Represents a mesh volume/surface/line/point.
Definition: gmsh_file_v2.h:151
std::vector< int > MeshPartitions
The id's of the partition to which this element belongs.
Definition: gmsh_file_v2.h:179
ElementType Type
The element type.
Definition: gmsh_file_v2.h:156
int ElementaryEntityNr
The number of the elementary entity to which this element belongs (second element tag in ....
Definition: gmsh_file_v2.h:171
int PhysicalEntityNr
The Number of the Physical Entity to which this element belongs (this is the first tag written in the...
Definition: gmsh_file_v2.h:162
std::vector< size_type > NodeNumbers
Contains the node numbers that make up this element (depends on the element type to)
Definition: gmsh_file_v2.h:186
Describes how 2 elementary entities are identified with each to represent periodic boundaries.
Definition: gmsh_file_v2.h:207
int ElementarySlaveNr
The elementary entity number (.
Definition: gmsh_file_v2.h:211
int Dimension
Dimension of the elementary entities that are coupled to each other.
Definition: gmsh_file_v2.h:209
std::vector< std::pair< size_type, size_type > > NodeMapping
A List of nodes that pairs nodes on the slave side with nodes on the master side.
Definition: gmsh_file_v2.h:223
int ElementaryMasterNr
The elementary entity number (.
Definition: gmsh_file_v2.h:213
Represents a physical entity as defined in gmsh. In GMSH a Physical entity is created through one of ...
Definition: gmsh_file_v2.h:40
int Number
The identification number of the Physical Entity This number is assigned to a physical entity as the ...
Definition: gmsh_file_v2.h:52
std::string Name
The name of this Physical Entity (provided.
Definition: gmsh_file_v2.h:54
A representation of a .msh file (V2) in a c++ data structure.
Definition: gmsh_file_v2.h:18
std::string VersionNumber
The version of GMSH of the msh file, equals usually 2.2.
Definition: gmsh_file_v2.h:21
int DoubleSize
how many bytes is a double?
Definition: gmsh_file_v2.h:25
std::vector< PhysicalEntity > PhysicalEntities
A list of all Physical entities that have a name.
Definition: gmsh_file_v2.h:62
std::vector< Element > Elements
A list of all Elements (Points,Lines,Surfaces or Volumes) present in the *.msh file.
Definition: gmsh_file_v2.h:196
ElementType
All possible element types (see GMSH documentation)
Definition: gmsh_file_v2.h:75
std::vector< std::pair< size_type, Eigen::Vector3d > > Nodes
The nodes that make up this mesh.
Definition: gmsh_file_v2.h:72
mesh::Mesh::size_type size_type
Definition: gmsh_file_v2.h:19
bool IsBinary
Is it a binary file?
Definition: gmsh_file_v2.h:23
std::vector< PeriodicEntity > Periodic
Definition: gmsh_file_v2.h:228
static const std::vector< ElementType > AllElementTypes
Contains a list of all element types that are possible.
Definition: gmsh_file_v2.h:144