NLMech  0.1.0
rw::writer::Writer Class Reference

A interface class writing data. More...

#include <writer.h>

Collaboration diagram for rw::writer::Writer:
Collaboration graph

Public Member Functions

void close ()
 Closes the file and store it to the hard disk.
 
void open (const std::string &filename, const std::string &format="vtu", const std::string &compress_type="")
 Open a .vtu file. More...
 
 Writer ()
 Constructor.
 
 Writer (const std::string &filename, const std::string &format="vtu", const std::string &compress_type="")
 Constructor. More...
 
 ~Writer ()
 Destructor.
 
Mesh data
void appendNodes (const std::vector< util::Point3 > *nodes, const std::vector< util::Point3 > *u=nullptr)
 Writes the nodes to the file. More...
 
void appendMesh (const std::vector< util::Point3 > *nodes, const size_t &element_type, const std::vector< size_t > *en_con, const std::vector< util::Point3 > *u=nullptr)
 Writes the mesh data to file. More...
 
Point data
void appendPointData (const std::string &name, const std::vector< uint8_t > *data)
 Writes the scalar point data to the file. More...
 
void appendPointData (const std::string &name, const std::vector< size_t > *data)
 Writes the scalar point data to the file. More...
 
void appendPointData (const std::string &name, const std::vector< int > *data)
 Writes the scalar point data to the file. More...
 
void appendPointData (const std::string &name, const std::vector< float > *data)
 Writes the scalar point data to the file. More...
 
void appendPointData (const std::string &name, const std::vector< double > *data)
 Writes the scalar point data to the file. More...
 
void appendPointData (const std::string &name, const std::vector< util::Point3 > *data)
 Writes the vector point data to the file. More...
 
void appendPointData (const std::string &name, const std::vector< util::SymMatrix3 > *data)
 Writes the symmetric matrix data associated to nodes to the file. More...
 
void appendPointData (const std::string &name, const std::vector< blaze::StaticMatrix< double, 3, 3 > > *data)
 Writes the matrix data associated to nodes to the file. More...
 
Cell data
void appendCellData (const std::string &name, const std::vector< float > *data)
 Writes the float data associated to cells to the file. More...
 
void appendCellData (const std::string &name, const std::vector< util::SymMatrix3 > *data)
 Writes the symmetric matrix data associated to cells to the file. More...
 
Field data
void appendFieldData (const std::string &name, const double &data)
 Writes the scalar field data to the file. More...
 
void appendFieldData (const std::string &name, const float &data)
 Writes the scalar field data to the file. More...
 
void addTimeStep (const double &timestep)
 Writes the time step to the file. More...
 

Private Member Functions

void checkLength (const size_t length, const std::string &name)
 Check if the field is not zero This check is important for the legacy vtk writer, since empty fields result in warnings while laoding the data. More...
 

Private Attributes

std::string d_format
 Format of output file.
 
rw::writer::LegacyVtkWriterd_legacyVtkWriter_p
 Pointer to the vtk writer class.
 
rw::writer::MshWriterd_mshWriter_p
 Pointer to the vtk writer class.
 
rw::writer::VtkWriterd_vtkWriter_p
 Pointer to the vtk writer class.
 

Detailed Description

A interface class writing data.

This interface separates the caller from vtk library.

Constructor & Destructor Documentation

◆ Writer()

rw::writer::Writer::Writer ( const std::string &  filename,
const std::string &  format = "vtu",
const std::string &  compress_type = "" 
)
explicit

Constructor.

Creates and opens .vtu file of name given by filename. The file remains open till the close() function is invoked or if the instance of this class is destroyed.

Parameters
filenameName of file which will be created
formatFormat of the output file, e.g. "vtu", "msh"
compress_typeSpecify the compression type (optional)
Here is the call graph for this function:

Member Function Documentation

◆ addTimeStep()

void rw::writer::Writer::addTimeStep ( const double &  timestep)

Writes the time step to the file.

Parameters
timestepCurrent time step of the simulation

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

Here is the caller graph for this function:

◆ appendCellData() [1/2]

void rw::writer::Writer::appendCellData ( const std::string &  name,
const std::vector< float > *  data 
)

Writes the float data associated to cells to the file.

Parameters
nameName of the data
dataVector containing the data

◆ appendCellData() [2/2]

void rw::writer::Writer::appendCellData ( const std::string &  name,
const std::vector< util::SymMatrix3 > *  data 
)

Writes the symmetric matrix data associated to cells to the file.

Parameters
nameName of the data
dataVector containing the data

◆ appendFieldData() [1/2]

void rw::writer::Writer::appendFieldData ( const std::string &  name,
const double &  data 
)

Writes the scalar field data to the file.

Parameters
nameName of the data
dataValue

◆ appendFieldData() [2/2]

void rw::writer::Writer::appendFieldData ( const std::string &  name,
const float &  data 
)

Writes the scalar field data to the file.

Parameters
nameName of the data
dataValue

◆ appendMesh()

void rw::writer::Writer::appendMesh ( const std::vector< util::Point3 > *  nodes,
const size_t &  element_type,
const std::vector< size_t > *  en_con,
const std::vector< util::Point3 > *  u = nullptr 
)

Writes the mesh data to file.

Parameters
nodesVector of nodal coordinates
element_typeType of element
en_conVector of element-node connectivity
uVector of nodal displacement

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

Here is the caller graph for this function:

◆ appendNodes()

void rw::writer::Writer::appendNodes ( const std::vector< util::Point3 > *  nodes,
const std::vector< util::Point3 > *  u = nullptr 
)

Writes the nodes to the file.

Parameters
nodesReference positions of the nodes
uNodal displacements

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

Here is the caller graph for this function:

◆ appendPointData() [1/8]

void rw::writer::Writer::appendPointData ( const std::string &  name,
const std::vector< blaze::StaticMatrix< double, 3, 3 > > *  data 
)

Writes the matrix data associated to nodes to the file.

Parameters
nameName of the data
dataVector containing the data

◆ appendPointData() [2/8]

void rw::writer::Writer::appendPointData ( const std::string &  name,
const std::vector< double > *  data 
)

Writes the scalar point data to the file.

Parameters
nameName of the data
dataVector containing the data

◆ appendPointData() [3/8]

void rw::writer::Writer::appendPointData ( const std::string &  name,
const std::vector< float > *  data 
)

Writes the scalar point data to the file.

Parameters
nameName of the data
dataVector containing the data

◆ appendPointData() [4/8]

void rw::writer::Writer::appendPointData ( const std::string &  name,
const std::vector< int > *  data 
)

Writes the scalar point data to the file.

Parameters
nameName of the data
dataVector containing the data

◆ appendPointData() [5/8]

void rw::writer::Writer::appendPointData ( const std::string &  name,
const std::vector< size_t > *  data 
)

Writes the scalar point data to the file.

Parameters
nameName of the data
dataVector containing the data

◆ appendPointData() [6/8]

void rw::writer::Writer::appendPointData ( const std::string &  name,
const std::vector< uint8_t > *  data 
)

Writes the scalar point data to the file.

Parameters
nameName of the data
dataVector containing the data

Referenced by tools::pp::Compute::Compute(), tools::pp::Compute::transformU(), and tools::pp::Compute::transformV().

Here is the caller graph for this function:

◆ appendPointData() [7/8]

void rw::writer::Writer::appendPointData ( const std::string &  name,
const std::vector< util::Point3 > *  data 
)

Writes the vector point data to the file.

Parameters
nameName of the data
dataVector containing the data

◆ appendPointData() [8/8]

void rw::writer::Writer::appendPointData ( const std::string &  name,
const std::vector< util::SymMatrix3 > *  data 
)

Writes the symmetric matrix data associated to nodes to the file.

Parameters
nameName of the data
dataVector containing the data

◆ checkLength()

void rw::writer::Writer::checkLength ( const size_t  length,
const std::string &  name 
)
inlineprivate

Check if the field is not zero This check is important for the legacy vtk writer, since empty fields result in warnings while laoding the data.

Parameters
lengthSize of the field
nameName of the field

◆ open()

void rw::writer::Writer::open ( const std::string &  filename,
const std::string &  format = "vtu",
const std::string &  compress_type = "" 
)

Open a .vtu file.

Parameters
filenameName of file which will be created
formatFormat of the output file, e.g. "vtu", "msh"
compress_typeCompression type (optional)

Referenced by tools::pp::Compute::initWriter(), and Writer().

Here is the caller graph for this function:

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