My Project
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
LineParser Class Reference

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.
 

Detailed Description

Parses .msh file.

Constructor & Destructor Documentation

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.

Parameters
fileNameis the fileName of the .msh file.
elementsis a list of element pointers found in LineMesh
nodesis a list of node pointers found in LineMesh

Member Function Documentation

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.


The documentation for this class was generated from the following files: