LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
gmsh_file_v2.h
1
10#ifndef INCG1fd687af60b74bf6aad50d509ecbc4da
11#define INCG1fd687af60b74bf6aad50d509ecbc4da
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
271
275template <>
276struct fmt::formatter<lf::io::GMshFileV2> : ostream_formatter {};
277
282template <>
283struct fmt::formatter<lf::io::GMshFileV2::ElementType> : ostream_formatter {};
285
286#endif // INCG1fd687af60b74bf6aad50d509ecbc4da
Represents a reference element with all its properties.
Definition ref_el.h:109
lf::base::size_type size_type
Mesh input (from file) and output (in various formats) facilities.
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:
size_type NumNodes(GMshFileV2::ElementType et)
Number of nodes that this element type has.
Definition assemble.h:31
Represents a mesh volume/surface/line/point.
std::vector< int > MeshPartitions
The id's of the partition to which this element belongs.
ElementType Type
The element type.
int ElementaryEntityNr
The number of the elementary entity to which this element belongs (second element tag in ....
int PhysicalEntityNr
The Number of the Physical Entity to which this element belongs (this is the first tag written in the...
std::vector< size_type > NodeNumbers
Contains the node numbers that make up this element (depends on the element type to)
Describes how 2 elementary entities are identified with each to represent periodic boundaries.
int ElementarySlaveNr
The elementary entity number (.
int Dimension
Dimension of the elementary entities that are coupled to each other.
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.
int ElementaryMasterNr
The elementary entity number (.
Represents a physical entity as defined in gmsh. In GMSH a Physical entity is created through one of ...
int Number
The identification number of the Physical Entity This number is assigned to a physical entity as the ...
std::string Name
The name of this Physical Entity (provided.
A representation of a .msh file (V2) in a c++ data structure.
std::string VersionNumber
The version of GMSH of the msh file, equals usually 2.2.
int DoubleSize
how many bytes is a double?
std::vector< PhysicalEntity > PhysicalEntities
A list of all Physical entities that have a name.
std::vector< Element > Elements
A list of all Elements (Points,Lines,Surfaces or Volumes) present in the *.msh file.
ElementType
All possible element types (see GMSH documentation)
std::vector< std::pair< size_type, Eigen::Vector3d > > Nodes
The nodes that make up this mesh.
mesh::Mesh::size_type size_type
bool IsBinary
Is it a binary file?
std::vector< PeriodicEntity > Periodic
static const std::vector< ElementType > AllElementTypes
Contains a list of all element types that are possible.