|
FEAT 3
Finite Element Analysis Toolbox
|
Gmsh file reader class. More...
#include <gmsh_reader.hpp>
Classes | |
| struct | BinaryElementsHeader |
| Header for a chunk of elements in binary .msh files. More... | |
| struct | FileView |
| Utility class for walking through potentially mixed ascii and binary .msh files. More... | |
Public Member Functions | |
| GmshFileReader (const std::filesystem::path &path) | |
| File path constructor. More... | |
| GmshFileReader (const std::istream &stream) | |
| Input stream constructor. More... | |
| ParsedMeshType | get_mesh_type () const |
| Returns the mesh-type of the parsed mesh. More... | |
| const String & | get_meshtype_string () const |
| Returns the mesh-type string of the parsed mesh. More... | |
| int | get_shape_dim () const |
| Returns the shape-dimension of the parsed mesh. More... | |
| ParsedShapeType | get_shape_type () const |
| Returns the shape-type of the parsed mesh. More... | |
| int | get_world_dim () const |
| Returns the world-dimension of the parsed mesh. More... | |
| template<typename MeshType_ > | |
| std::unique_ptr< RootMeshNode< MeshType_ > > | parse (MeshAtlas< MeshType_ > &mesh_atlas, PartitionSet *part_set=nullptr) |
| Parses the mesh file into a mesh node and a mesh atlas. More... | |
| void | read_root_markup () |
| Reads the root markup from the input stream and analyses it. More... | |
Private Member Functions | |
| void | read_data (const std::istream &stream) |
| Read file into string. More... | |
| void | scan_elements (FileView &view) |
| Gather start position(s) of element data and ensure the mesh contains only a single element type. More... | |
| void | scan_nodes (FileView &view) |
| Gather number of nodes and start position of node data. More... | |
Static Private Member Functions | |
| static std::size_t | binary_element_chunk_size (const BinaryElementsHeader &header) |
| Size (in bytes) of one chunk of elements in a binary .msh file. More... | |
| static int | element_type_to_shape_dim (int type) |
| .msh element type to shape dimension mapping More... | |
| static ParsedShapeType | element_type_to_shape_type (int type) |
| .msh element type to ShapeType mapping More... | |
| static int | msh_to_feat_order (int type, int node) |
| Re-ordering for cell vertices. More... | |
| static int | nodes_per_element (int type) |
| .msh element type to number of nodes per element More... | |
Private Attributes | |
| std::size_t | _data_size = 8 |
| .msh size for reals More... | |
| std::vector< BinaryElementsHeader > | _element_headers |
| Element chunks, for binary files. More... | |
| int | _element_type = -1 |
| .msh element type More... | |
| const char * | _elements_start = nullptr |
| Start of elements in the file, for ascii files. More... | |
| String | _file_contents |
| Contents of the .msh file. More... | |
| bool | _have_root_markup = false |
| bool | _is_binary = false |
| .msh ascii/binary indicator More... | |
| String | _mesh_type_string = "" |
| Mesh type string. More... | |
| const char * | _nodes_start = nullptr |
| Start of nodes in the file. More... | |
| std::size_t | _num_elements = 0 |
| Number of elements in the file. More... | |
| std::size_t | _num_nodes = 0 |
| Number of nodes in the file. More... | |
| int | _shape_dim = 0 |
| Shape dimension. More... | |
| ParsedShapeType | _shape_type = ParsedShapeType::unknown |
| Shape type. More... | |
| double | _version = 0.0 |
| .msh file version More... | |
Gmsh file reader class.
This class implements a reader which parses Gmesh's .msh files into a RootMeshNode.
The basic usage is as follows:
For more details on meshes, see the related doxygen page FEAT Mesh File Format.
Limitations:
See Chapter 10 of https://gmsh.info/dev/doc/texinfo/gmsh.pdf for detail on the mesh format.
Definition at line 48 of file gmsh_reader.hpp.
|
inlineexplicit |
|
inlineexplicit |
File path constructor.
Definition at line 211 of file gmsh_reader.hpp.
References read_data(), FEAT::stringify(), and XASSERTM.
|
inlinestaticprivate |
Size (in bytes) of one chunk of elements in a binary .msh file.
Definition at line 540 of file gmsh_reader.hpp.
References nodes_per_element(), FEAT::Geometry::GmshFileReader::BinaryElementsHeader::num_elements, FEAT::Geometry::GmshFileReader::BinaryElementsHeader::tags_per_element, and FEAT::Geometry::GmshFileReader::BinaryElementsHeader::type.
Referenced by scan_elements().
|
inlinestaticprivate |
.msh element type to shape dimension mapping
Definition at line 561 of file gmsh_reader.hpp.
References XABORTM.
Referenced by read_root_markup().
|
inlinestaticprivate |
.msh element type to ShapeType mapping
Definition at line 548 of file gmsh_reader.hpp.
References FEAT::Geometry::hypercube, FEAT::Geometry::simplex, and XABORTM.
Referenced by read_root_markup().
|
inline |
Returns the mesh-type of the parsed mesh.
Definition at line 244 of file gmsh_reader.hpp.
References FEAT::Geometry::conformal.
|
inline |
Returns the mesh-type string of the parsed mesh.
Definition at line 229 of file gmsh_reader.hpp.
References _mesh_type_string.
|
inline |
Returns the shape-dimension of the parsed mesh.
Definition at line 274 of file gmsh_reader.hpp.
References _shape_dim.
|
inline |
Returns the shape-type of the parsed mesh.
Definition at line 259 of file gmsh_reader.hpp.
References _shape_type.
|
inline |
Returns the world-dimension of the parsed mesh.
Definition at line 289 of file gmsh_reader.hpp.
Referenced by parse().
|
inlinestaticprivate |
Re-ordering for cell vertices.
.msh file and FEAT use different conventions for the ordering of local vertices of a cell. This function provides a mapping to correct for these different conventions
Definition at line 593 of file gmsh_reader.hpp.
References XABORTM.
Referenced by parse().
|
inlinestaticprivate |
.msh element type to number of nodes per element
Definition at line 574 of file gmsh_reader.hpp.
References XABORTM.
Referenced by binary_element_chunk_size(), and parse().
|
inline |
Parses the mesh file into a mesh node and a mesh atlas.
| [in,out] | mesh_atlas | Currently unused, only accepted for compatibility |
| [in,out] | part_set | Currently unused, only accepted for compatibility |
Definition at line 360 of file gmsh_reader.hpp.
References _data_size, _element_headers, _element_type, _elements_start, _file_contents, _is_binary, _nodes_start, _num_elements, _num_nodes, _shape_dim, _shape_type, FEAT::Geometry::GmshFileReader::FileView::advance(), get_world_dim(), FEAT::Geometry::hypercube, FEAT::Geometry::GmshFileReader::FileView::memcpy(), msh_to_feat_order(), nodes_per_element(), FEAT::Geometry::GmshFileReader::FileView::parse_line(), read_root_markup(), FEAT::Geometry::simplex, XABORTM, and XASSERT.
|
inlineprivate |
Read file into string.
Definition at line 703 of file gmsh_reader.hpp.
References _file_contents, and XASSERT.
Referenced by GmshFileReader().
|
inline |
Reads the root markup from the input stream and analyses it.
Definition at line 297 of file gmsh_reader.hpp.
References _data_size, _element_type, _file_contents, _is_binary, _mesh_type_string, _shape_dim, _shape_type, _version, element_type_to_shape_dim(), element_type_to_shape_type(), scan_elements(), scan_nodes(), FEAT::stringify(), XASSERT, and XASSERTM.
Referenced by parse().
|
inlineprivate |
Gather start position(s) of element data and ensure the mesh contains only a single element type.
Definition at line 638 of file gmsh_reader.hpp.
References _element_headers, _element_type, _elements_start, _is_binary, _num_elements, binary_element_chunk_size(), and XASSERT.
Referenced by read_root_markup().
|
inlineprivate |
Gather number of nodes and start position of node data.
Definition at line 614 of file gmsh_reader.hpp.
References _data_size, _is_binary, _nodes_start, _num_nodes, and XASSERT.
Referenced by read_root_markup().
|
private |
.msh size for reals
Definition at line 174 of file gmsh_reader.hpp.
Referenced by parse(), read_root_markup(), and scan_nodes().
|
private |
Element chunks, for binary files.
Definition at line 186 of file gmsh_reader.hpp.
Referenced by parse(), and scan_elements().
|
private |
.msh element type
Definition at line 180 of file gmsh_reader.hpp.
Referenced by parse(), read_root_markup(), and scan_elements().
|
private |
Start of elements in the file, for ascii files.
Definition at line 184 of file gmsh_reader.hpp.
Referenced by parse(), and scan_elements().
|
private |
Contents of the .msh file.
Definition at line 162 of file gmsh_reader.hpp.
Referenced by parse(), read_data(), and read_root_markup().
|
private |
Definition at line 164 of file gmsh_reader.hpp.
|
private |
.msh ascii/binary indicator
Definition at line 172 of file gmsh_reader.hpp.
Referenced by parse(), read_root_markup(), scan_elements(), and scan_nodes().
|
private |
Mesh type string.
Definition at line 191 of file gmsh_reader.hpp.
Referenced by get_meshtype_string(), and read_root_markup().
|
private |
Start of nodes in the file.
Definition at line 182 of file gmsh_reader.hpp.
Referenced by parse(), and scan_nodes().
|
private |
Number of elements in the file.
Definition at line 178 of file gmsh_reader.hpp.
Referenced by parse(), and scan_elements().
|
private |
Number of nodes in the file.
Definition at line 176 of file gmsh_reader.hpp.
Referenced by parse(), and scan_nodes().
|
private |
Shape dimension.
Definition at line 195 of file gmsh_reader.hpp.
Referenced by get_shape_dim(), parse(), and read_root_markup().
|
private |
Shape type.
Definition at line 193 of file gmsh_reader.hpp.
Referenced by get_shape_type(), parse(), and read_root_markup().
|
private |