GMSH Parser¶
Import, parse and store mesh data for a geometry.
This file is a part of the coursework module Personal Programming Project (PPP) in M.Sc. Computational Materials Science, Technische Universität Bergakademie Freiberg.
This file is a part of the project Modeling of radiative heat-exchange using finite element method
This file reads *.msh files written with GMSH’s native version
2 file format. (Legacy) ParseElements class classifies the elements
according to their type as defined in the GMSH documentation.
- class parser.Mesh(CONFIG_FILE: Path = None)¶
Bases:
ParseElements,ParseNodes,ParseFormatClass that inherits all the above classes. Provides a single entity for all the information.
- property coordinates¶
Coordinates of all the nodes in the mesh.
- class parser.ParseElements(CONFIG_FILE: Path = None)¶
Bases:
objectParses the elements from the mesh file provided.
- N_ELEM¶
Number of elements as present in the file.
- Type:
int
- ELEM_PARSE_STATUS¶
Indicator for status of parsing nodes.
- Type:
bool
- Elements¶
Dictionary consisting of all the elements parsed.
Keys are numbers of the elements.
Consists of
entities.Elementitems.
- Type:
dict
- property Elements: dict¶
Dictionary containing all elements as parsed from the mesh file.
- property boundaryElements: defaultdict(<class 'set'>, {})¶
Elements of the boundary.
- property boundaryNodes: defaultdict(<class 'set'>, {})¶
Nodes of the elements present on the boundary.
- compute_boundary() None¶
Computes elements present on the boundary.
- property edgeElements: list¶
List of all 2-node linear elements present in the mesh file.
- group_elements() None¶
Method to group elements based on their type. GMSH documentation
- property pointElements: list¶
List of all 1-node elements present in the mesh file.
- property quadElements: list¶
List of all 4-node quadrilateral elements present in the mesh file.
- set_elements_content() None¶
Sets the output content string.
- property triElements: list¶
List of all 3-node triangular elements present in the mesh file.
- class parser.ParseFormat(CONFIG_FILE: Path = None)¶
Bases:
objectParses the format of the mesh.
- version_number¶
Version number of the mesh file. Currently only Version 2 of GMSH native format supported
- Type:
float
- file_type¶
ASCII.
- Type:
string
- mesh_size¶
- Type:
int
- FORMAT_PARSE_STATUS¶
Indicator for status of the parsing.
- Type:
bool
- set_format_content() None¶
Sets the output string.
- class parser.ParseNodes(CONFIG_FILE: Path = None)¶
Bases:
objectParses the nodes from the mesh file provided.
- N_NODES¶
Number of nodes as present in the file.
- Type:
int
- NODE_PARSE_STATUS¶
Indicator for status of parsing nodes.
- Type:
bool
- Nodes¶
Dictionary consisting of all the nodes parsed.
Keys are tags of the node.
Consists of
entities.Nodeitems.
- Type:
dict
- property Nodes: dict¶
Dictionary containing all nodes as parsed from the mesh file.
- set_nodes_content() None¶
Sets the output string.