My Project
|
Parses .msh file. More...
#include <LineParser.h>
Public Member Functions | |
LineParser (std::string fileName, std::vector< LineElement * > &elements, std::vector< Node > &nodes) | |
Constructor. More... | |
void | load_msh (std::ifstream &, std::vector< LineElement * > &elements, std::vector< Node > &nodes) |
Loads the .msh data into the elements and nodes vectors. More... | |
bool | readMeshFormat (std::ifstream &, double *) |
Verifies the mesh format of the file. | |
bool | readElements (std::ifstream &, std::vector< LineElement * > *, 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. | |
void | readInt (std::ifstream &in, int *number) |
Assigns an integer value from the .msh file to the number argument. | |
void | readDouble (std::ifstream &in, double *number) |
Assigns a double value from the .msh file to the number argument. | |
bool | filePosEqualsLine (std::ifstream &, std::string) |
Verifies that the line from the file matches with .msh format version. | |
void | createTwoNodeLineElement (std::ifstream &in, std::vector< LineElement * > *elements, int type, std::vector< Node > &nodes) |
Creates a three-node triangle and appends it to the element list. | |
void | createThreeNodeLineElement (std::ifstream &in, std::vector< LineElement * > *elements, int type, std::vector< Node > &nodes) |
Creates a six-node triangle and appends it to the element list. | |
Public Attributes | |
std::string | line |
Data on line in current position in file. | |
Static Public Attributes | |
static const int | TWO_NODED_LINE = 1 |
Integer for selecting element type based on the .msh format. | |
static const int | THREE_NODED_LINE = 8 |
Integer for selecting element type based on the .msh format. | |
Parses .msh file.
LineParser::LineParser | ( | std::string | fileName, |
std::vector< LineElement * > & | elements, | ||
std::vector< Node > & | nodes | ||
) |
Constructor.
The constructor takes the filename, and the elements vector and nodes vector from LineMesh as arguments. It opens the .msh file and loads the elements and nodes into the respective vector.
void LineParser::load_msh | ( | std::ifstream & | file, |
std::vector< LineElement * > & | elements, | ||
std::vector< Node > & | nodes | ||
) |
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.
bool LineParser::readElements | ( | std::ifstream & | in, |
std::vector< LineElement * > * | elements, | ||
std::vector< Node > & | nodes | ||
) |
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.