NLMech  0.1.0
rw::reader::MshReader Class Reference

A class to read Gmsh (msh) mesh files. More...

#include <mshReader.h>

Collaboration diagram for rw::reader::MshReader:
Collaboration graph

Public Member Functions

void close ()
 Close the file.
 
 MshReader (const std::string &filename)
 Constructor. More...
 
void readMesh (size_t dim, std::vector< util::Point3 > *nodes, size_t &element_type, size_t &num_elem, std::vector< size_t > *enc, std::vector< std::vector< size_t >> *nec, std::vector< double > *volumes, bool is_fd=false)
 Reads mesh data into node file and element file. More...
 
void readNodes (std::vector< util::Point3 > *nodes)
 Reads nodal position. More...
 
bool readPointData (const std::string &name, std::vector< double > *data)
 reads point data from .vtu file More...
 
bool readPointData (const std::string &name, std::vector< util::Point3 > *data)
 reads point data from .vtu file More...
 

Private Attributes

std::ifstream d_file
 vtk/vtu file
 
std::string d_filename
 filename
 

Detailed Description

A class to read Gmsh (msh) mesh files.

Constructor & Destructor Documentation

◆ MshReader()

rw::reader::MshReader::MshReader ( const std::string &  filename)
explicit

Constructor.

Parameters
filenameName of the mesh file

Member Function Documentation

◆ readMesh()

void rw::reader::MshReader::readMesh ( size_t  dim,
std::vector< util::Point3 > *  nodes,
size_t &  element_type,
size_t &  num_elem,
std::vector< size_t > *  enc,
std::vector< std::vector< size_t >> *  nec,
std::vector< double > *  volumes,
bool  is_fd = false 
)

Reads mesh data into node file and element file.

Parameters
dimDimension
nodesVector of nodes data
element_typeType of element
num_elemNumber of elements
encVector holding element-node connectivity
necVector holding node-element connectivity
volumesVector holding volume of the nodes
is_fdFlag indicating if this mesh is for finite_difference simulation

◆ readNodes()

void rw::reader::MshReader::readNodes ( std::vector< util::Point3 > *  nodes)

Reads nodal position.

Parameters
nodesVector of nodal coordinates

◆ readPointData() [1/2]

bool rw::reader::MshReader::readPointData ( const std::string &  name,
std::vector< double > *  data 
)

reads point data from .vtu file

Parameters
nameName of data
dataPointer to the vector of data
Returns
status True if data is found otherwise false

◆ readPointData() [2/2]

bool rw::reader::MshReader::readPointData ( const std::string &  name,
std::vector< util::Point3 > *  data 
)

reads point data from .vtu file

Parameters
nameName of data
dataPointer to the vector of data
Returns
status True if data is found otherwise false

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