NLMech  0.1.0
rw::reader Namespace Reference

Collection of methods and database related to reading. More...

Data Structures

class  MshReader
 A class to read Gmsh (msh) mesh files. More...
 
class  VtkReader
 A class to read VTK (.vtu) mesh files. More...
 

Functions

CSV specific functions
void readCsvFile (const std::string &filename, size_t dim, std::vector< util::Point3 > *nodes, std::vector< double > *volumes)
 Reads mesh data into node file and element file. More...
 
VTU specific functions
void readVtuFile (const std::string &filename, 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 readVtuFileNodes (const std::string &filename, size_t dim, std::vector< util::Point3 > *nodes, bool ref_config=false)
 Reads nodal coordinates. More...
 
bool vtuHasPointData (const std::string &filename, const std::string &tag)
 Checks if file has needed data. More...
 
bool vtuHasCellData (const std::string &filename, const std::string &tag)
 Checks if file has needed data. More...
 
std::vector< std::string > readVtuFilePointTags (const std::string &filename)
 Reads all point data tags. More...
 
std::vector< std::string > readVtuFileCellTags (const std::string &filename)
 Reads all cell data tags. More...
 
void readVtuFileCells (const std::string &filename, size_t dim, size_t &element_type, size_t &num_elem, std::vector< size_t > *enc, std::vector< std::vector< size_t >> *nec)
 Reads cell data, i.e. element-node connectivity and node-element connectivity. More...
 
void readVtuFileRestart (const std::string &filename, std::vector< util::Point3 > *u, std::vector< util::Point3 > *v, const std::vector< util::Point3 > *X=nullptr)
 Reads mesh data into node file and element file. More...
 
bool readVtuFilePointData (const std::string &filename, const std::string &tag, std::vector< uint8_t > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFilePointData (const std::string &filename, const std::string &tag, std::vector< size_t > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFilePointData (const std::string &filename, const std::string &tag, std::vector< int > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFilePointData (const std::string &filename, const std::string &tag, std::vector< float > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFilePointData (const std::string &filename, const std::string &tag, std::vector< double > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFilePointData (const std::string &filename, const std::string &tag, std::vector< util::Point3 > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFilePointData (const std::string &filename, const std::string &tag, std::vector< util::SymMatrix3 > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFilePointData (const std::string &filename, const std::string &tag, std::vector< util::Matrix33 > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFileCellData (const std::string &filename, const std::string &tag, std::vector< float > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFileCellData (const std::string &filename, const std::string &tag, std::vector< double > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFileCellData (const std::string &filename, const std::string &tag, std::vector< util::Point3 > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFileCellData (const std::string &filename, const std::string &tag, std::vector< util::SymMatrix3 > *data)
 Reads data of specified tag from the vtu file. More...
 
bool readVtuFileCellData (const std::string &filename, const std::string &tag, std::vector< util::Matrix33 > *data)
 Reads data of specified tag from the vtu file. More...
 
MSH specific functions
void readMshFile (const std::string &filename, 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 readMshFileRestart (const std::string &filename, std::vector< util::Point3 > *u, std::vector< util::Point3 > *v, const std::vector< util::Point3 > *X=nullptr)
 Reads mesh data into node file and element file. More...
 
bool readMshFilePointData (const std::string &filename, const std::string &tag, std::vector< double > *data)
 Reads data of specified tag from the vtu file. More...
 

Detailed Description

Collection of methods and database related to reading.

This namespace provides methods and data members specific to reading of the mesh data. Currently, .csv, .vtu and .msh files are supported.

Function Documentation

◆ readCsvFile()

void rw::reader::readCsvFile ( const std::string &  filename,
size_t  dim,
std::vector< util::Point3 > *  nodes,
std::vector< double > *  volumes 
)

Reads mesh data into node file and element file.

Parameters
filenameName of mesh file
dimDimension
nodesVector of nodes data
volumesVector holding volume of the nodes

Referenced by fe::Mesh::createData().

Here is the caller graph for this function:

◆ readMshFile()

void rw::reader::readMshFile ( const std::string &  filename,
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
filenameName of mesh file
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

Referenced by fe::Mesh::createData().

Here is the caller graph for this function:

◆ readMshFilePointData()

bool rw::reader::readMshFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< double > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readMshFileRestart()

void rw::reader::readMshFileRestart ( const std::string &  filename,
std::vector< util::Point3 > *  u,
std::vector< util::Point3 > *  v,
const std::vector< util::Point3 > *  X = nullptr 
)

Reads mesh data into node file and element file.

Parameters
filenameName of mesh file
uPointer to vector of nodal displacement
vPointer to vector of nodal velocity
XPointer to vector of nodal reference position (Optional)

Referenced by tools::pp::Compute::Compute(), and model::FDModel< T >::restart().

Here is the caller graph for this function:

◆ readVtuFile()

void rw::reader::readVtuFile ( const std::string &  filename,
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
filenameName of mesh file
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

◆ readVtuFileCellData() [1/5]

bool rw::reader::readVtuFileCellData ( const std::string &  filename,
const std::string &  tag,
std::vector< double > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFileCellData() [2/5]

bool rw::reader::readVtuFileCellData ( const std::string &  filename,
const std::string &  tag,
std::vector< float > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFileCellData() [3/5]

bool rw::reader::readVtuFileCellData ( const std::string &  filename,
const std::string &  tag,
std::vector< util::Matrix33 > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFileCellData() [4/5]

bool rw::reader::readVtuFileCellData ( const std::string &  filename,
const std::string &  tag,
std::vector< util::Point3 > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFileCellData() [5/5]

bool rw::reader::readVtuFileCellData ( const std::string &  filename,
const std::string &  tag,
std::vector< util::SymMatrix3 > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFileCells()

void rw::reader::readVtuFileCells ( const std::string &  filename,
size_t  dim,
size_t &  element_type,
size_t &  num_elem,
std::vector< size_t > *  enc,
std::vector< std::vector< size_t >> *  nec 
)

Reads cell data, i.e. element-node connectivity and node-element connectivity.

Parameters
filenameName of mesh file
dimDimension
element_typeType of element
num_elemNumber of elements
encElement-node connectivity
necNode-element connectivity

Referenced by fe::Mesh::createData().

Here is the caller graph for this function:

◆ readVtuFileCellTags()

std::vector< std::string > rw::reader::readVtuFileCellTags ( const std::string &  filename)

Reads all cell data tags.

Parameters
filenameName of mesh file
Returns
List List of point data tags

◆ readVtuFileNodes()

void rw::reader::readVtuFileNodes ( const std::string &  filename,
size_t  dim,
std::vector< util::Point3 > *  nodes,
bool  ref_config = false 
)

Reads nodal coordinates.

Parameters
filenameName of mesh file
dimDimension
nodesVector of nodes data
ref_configFlag which specifies if we need to subtract the displacement from nodes obtained from vtu file to get reference position of nodes

Referenced by fe::Mesh::createData().

Here is the caller graph for this function:

◆ readVtuFilePointData() [1/8]

bool rw::reader::readVtuFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< double > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFilePointData() [2/8]

bool rw::reader::readVtuFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< float > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFilePointData() [3/8]

bool rw::reader::readVtuFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< int > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFilePointData() [4/8]

bool rw::reader::readVtuFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< size_t > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFilePointData() [5/8]

bool rw::reader::readVtuFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< uint8_t > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

Referenced by tools::pp::Compute::Compute(), and fe::Mesh::createData().

Here is the caller graph for this function:

◆ readVtuFilePointData() [6/8]

bool rw::reader::readVtuFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< util::Matrix33 > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFilePointData() [7/8]

bool rw::reader::readVtuFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< util::Point3 > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFilePointData() [8/8]

bool rw::reader::readVtuFilePointData ( const std::string &  filename,
const std::string &  tag,
std::vector< util::SymMatrix3 > *  data 
)

Reads data of specified tag from the vtu file.

Parameters
filenameName of mesh file
tagName of point data to be read from .vtu file
dataPointer to vector of point data
Returns
bool True if found the data in file

◆ readVtuFilePointTags()

std::vector< std::string > rw::reader::readVtuFilePointTags ( const std::string &  filename)

Reads all point data tags.

Parameters
filenameName of mesh file
Returns
List List of point data tags

◆ readVtuFileRestart()

void rw::reader::readVtuFileRestart ( const std::string &  filename,
std::vector< util::Point3 > *  u,
std::vector< util::Point3 > *  v,
const std::vector< util::Point3 > *  X = nullptr 
)

Reads mesh data into node file and element file.

Parameters
filenameName of mesh file
uPointer to vector of nodal displacement
vPointer to vector of nodal velocity
XPointer to vector of nodal reference position (Optional)

Referenced by tools::pp::Compute::Compute(), and model::FDModel< T >::restart().

Here is the caller graph for this function:

◆ vtuHasCellData()

bool rw::reader::vtuHasCellData ( const std::string &  filename,
const std::string &  tag 
)

Checks if file has needed data.

Parameters
filenameName of mesh file
tagTag name of data
Returns
True If file has data otherwise false

◆ vtuHasPointData()

bool rw::reader::vtuHasPointData ( const std::string &  filename,
const std::string &  tag 
)

Checks if file has needed data.

Parameters
filenameName of mesh file
tagTag name of data
Returns
True If file has data otherwise false

Referenced by tools::pp::Compute::Compute().

Here is the caller graph for this function: