Interprets massive meshes structured in the ".msh" format.
More...
#include <MSHParser.h>
|
static const int | THREE_NODED_TRIANGLE = 2 |
| Integer for selecting element type T3based on the .msh format.
|
|
static const int | SIX_NODED_TRIANGLE = 9 |
| Integer for selecting element type T6 based on the .msh format.
|
|
static const int | FOUR_NODED_QUAD = 3 |
| Integer for selecting element type Q4 based on the .msh format.
|
|
static const int | NINE_NODED_QUAD = 10 |
| Integer for selecting element type Q9 based on the .msh format.
|
|
|
void | load_msh (std::ifstream &file, std::vector< Element * > &elements, std::vector< Node > &nodes) |
| Loads the .msh data into the elements and nodes vectors. More...
|
|
bool | readMeshFormat (std::ifstream &in, double *version) |
| Reads the mesh format. More...
|
|
bool | readElements (std::ifstream &in, std::vector< Element * > *elements, std::vector< Node > &nodes) |
| Reads the elements from .msh file. More...
|
|
bool | readNodes (std::ifstream &in, std::vector< Node > *nodes) |
| Reads the nodes from the .msh file. More...
|
|
void | readInt (std::ifstream &in, int *number) |
| Assigns an integer value from the .msh file to the number pointer. More...
|
|
void | readDouble (std::ifstream &in, double *number) |
| Assigns a double value from the .msh file to the number pointer. More...
|
|
bool | filePosEqualsLine (std::ifstream &line, std::string string) |
| Verifies that the line from the file matches with .msh format version. More...
|
|
void | createThreeNodeTriangleElement (std::ifstream &in, std::vector< Element * > *elements, int type, std::vector< Node > &nodes) |
| Creates a three-node triangle and appends it to the element list. More...
|
|
void | createSixNodeTriangleElement (std::ifstream &in, std::vector< Element * > *elements, int type, std::vector< Node > &nodes) |
| Creates a six-node triangle and appends it to the element list. More...
|
|
void | createFourNodeQuadElement (std::ifstream &in, std::vector< Element * > *elements, int type, std::vector< Node > &nodes) |
| Creates a four-node quadrilateral element and appends it to the element list. More...
|
|
void | createNineNodeQuadElement (std::ifstream &in, std::vector< Element * > *elements, int type, std::vector< Node > &nodes) |
| Creates a nine-node quadrilateral element and appends it to the element list. More...
|
|
|
std::string | line |
| Data on line in current position in file.
|
|
Interprets massive meshes structured in the ".msh" format.
MSHParser::MSHParser |
( |
std::string |
fileName, |
|
|
std::vector< Element * > & |
elements, |
|
|
std::vector< Node > & |
nodes |
|
) |
| |
Constructor.
The constructor takes the filename, and the elements vector and nodes vector from Mesh as arguments. It opens the .msh file and loads the elements and nodes into the respective vector.
- Parameters
-
fileName | is the fileName of the .msh file. |
elements | is a list of element pointers found in Mesh |
nodes | is a list of node pointers found in Mesh |
void MSHParser::createFourNodeQuadElement |
( |
std::ifstream & |
in, |
|
|
std::vector< Element * > * |
elements, |
|
|
int |
type, |
|
|
std::vector< Node > & |
nodes |
|
) |
| |
|
private |
Creates a four-node quadrilateral element and appends it to the element list.
- Parameters
-
in | input stream |
elements | pointer to a vector with all the elements in cross-section |
type | ensures correct element type is created |
nodes | vector of all nodes in cross-section |
void MSHParser::createNineNodeQuadElement |
( |
std::ifstream & |
in, |
|
|
std::vector< Element * > * |
elements, |
|
|
int |
type, |
|
|
std::vector< Node > & |
nodes |
|
) |
| |
|
private |
Creates a nine-node quadrilateral element and appends it to the element list.
- Parameters
-
in | input stream |
elements | pointer to a vector with all the elements in cross-section |
type | ensures correct element type is created |
nodes | vector of all nodes in cross-section |
void MSHParser::createSixNodeTriangleElement |
( |
std::ifstream & |
in, |
|
|
std::vector< Element * > * |
elements, |
|
|
int |
type, |
|
|
std::vector< Node > & |
nodes |
|
) |
| |
|
private |
Creates a six-node triangle and appends it to the element list.
- Parameters
-
in | input stream |
elements | pointer to a vector with all the elements in cross-section |
type | ensures correct element type is created |
nodes | vector of all nodes in cross-section |
void MSHParser::createThreeNodeTriangleElement |
( |
std::ifstream & |
in, |
|
|
std::vector< Element * > * |
elements, |
|
|
int |
type, |
|
|
std::vector< Node > & |
nodes |
|
) |
| |
|
private |
Creates a three-node triangle and appends it to the element list.
- Parameters
-
in | input stream |
elements | pointer to a vector with all the elements in cross-section |
type | ensures correct element type is created |
nodes | vector of all nodes in cross-section |
bool MSHParser::filePosEqualsLine |
( |
std::ifstream & |
line, |
|
|
std::string |
string |
|
) |
| |
|
private |
Verifies that the line from the file matches with .msh format version.
- Parameters
-
line | input line to check |
string | used to verify input line |
- Returns
- true if line matches string
void MSHParser::load_msh |
( |
std::ifstream & |
file, |
|
|
std::vector< Element * > & |
elements, |
|
|
std::vector< Node > & |
nodes |
|
) |
| |
|
private |
Loads the .msh data into the elements and nodes vectors.
Interprets the mesh data in the datastream and creates two vectors, containing nodes and elements respectively.
- Parameters
-
file | input file |
elements | list of element pointers from Mesh |
nodes | list of node pointers from Mesh |
void MSHParser::readDouble |
( |
std::ifstream & |
in, |
|
|
double * |
number |
|
) |
| |
|
private |
Assigns a double value from the .msh file to the number pointer.
- Parameters
-
in | input stream |
number | pointer is assigned value of in |
bool MSHParser::readElements |
( |
std::ifstream & |
in, |
|
|
std::vector< Element * > * |
elements, |
|
|
std::vector< Node > & |
nodes |
|
) |
| |
|
private |
Reads the elements from .msh file.
Reads the section of file containg element definitions, and creates a vector containing all supported elements.
Currently, only triangle elements are supported. All other element types are ignored
- Parameters
-
in | input stream |
elements | list of element pointers |
nodes | list of node pointers |
- Returns
- true if input line is at the end of the elements in .msh, false otherwise
void MSHParser::readInt |
( |
std::ifstream & |
in, |
|
|
int * |
number |
|
) |
| |
|
private |
Assigns an integer value from the .msh file to the number pointer.
- Parameters
-
in | input stream |
number | pointer is assigned value of in |
bool MSHParser::readMeshFormat |
( |
std::ifstream & |
in, |
|
|
double * |
version |
|
) |
| |
|
private |
Reads the mesh format.
Ensures that the mesh is of correct format
- Parameters
-
in | input stream |
mesh | version |
- Returns
- true if mesh is correct format, false otherwiseVerifies the mesh format of the file
bool MSHParser::readNodes |
( |
std::ifstream & |
in, |
|
|
std::vector< Node > * |
nodes |
|
) |
| |
|
private |
Reads the nodes from the .msh file.
Reads node data from .msh file and creates a corresponding node with x- and y-coordinates, as well as a unique node id.
- Parameters
-
in | input stream |
nodes | list of node pointers |
- Returns
- true if input line is at the end of the nodes in .msh, false otherwise
The documentation for this class was generated from the following files:
- C:/Users/simenva/Documents/GitHubVisualStudio/CrossSectionSolver/Solver/MSHParser.h
- C:/Users/simenva/Documents/GitHubVisualStudio/CrossSectionSolver/Solver/MSHParser.cpp