![]() |
Writes results to file for massive analysis. More...
#include <ResultWriter.h>
Public Member Functions | |
ResultWriter (std::string fileName, Mesh mesh) | |
Constructor taking the filename and mesh as parameters. More... | |
bool | open () |
Opens the file given by the filename. | |
void | save () |
Closes the file. | |
void | writeVtkHeader () |
writes the header for the .vtk file More... | |
void | writeMeshTopology (std::vector< Node > &nodes, std::vector< Element * > &elements) |
Writes the mesh topology to the result file (all points and polygons needed to represent the cross-section) More... | |
void | writePointScalarData (std::string name, MatrixXd data) |
Writes scalar data to the result VTK file. More... | |
void | writePointVectorData (std::string name, MatrixXd data) |
Writes vector data to the result VTK file. More... | |
void | writeCoordinateSystem (std::string name, int size) |
Applies a coordinate system made of VTK glyphs over the result file. More... | |
void | writeShearCenter (std::string name, int size) |
Applies a VTK box glyph at the shear center. More... | |
void | createTextFile (std::string fileNameNoExt) |
Creates a .txt file. More... | |
bool | openTXT () |
Opens a .txt file. | |
void | writeMeshSTLTopology (std::vector< Node > &nodes, std::vector< Element * > &elements) |
Writes the mesh stl topology to the result file (all points and polygons needed to represent the cross-section) More... | |
Public Attributes | |
bool | writeSTL |
Boolean that decides wether to write regular VTK format or STL format. | |
Private Attributes | |
Mesh | mesh |
Reference to Mesh object containg mesh data. | |
std::string | fileName |
File name of file to write results with folder extension. | |
Static Private Attributes | |
static const int | extraVTKNodes = 3 |
Number of extra nodes used for displaying VTK glyphs. | |
Writes results to file for massive analysis.
Resultwriter is responsible for writing data to file. It also contains definitions and the structure of results.
ResultWriter::ResultWriter | ( | std::string | fileName, |
Mesh | mesh | ||
) |
Constructor taking the filename and mesh as parameters.
fileName | fileName of .msh file with folder extension |
mesh | the mesh that has been analyzed |
void ResultWriter::createTextFile | ( | std::string | fileNameNoExt | ) |
Creates a .txt file.
Outputs applied loads, cross-sectional parameters and stiffnesses
fileNameNoExt | the file name without and folder extension |
void ResultWriter::writeCoordinateSystem | ( | std::string | name, |
int | size | ||
) |
Applies a coordinate system made of VTK glyphs over the result file.
In order to create the principal coordinate system, two extra nodes and two extra vector values are needed. The nodes decide the positioning of the coordinate system, while the vector decides the direction.
name | string naming the data in the result VTK file |
size | the number of nodes in the cross-section |
void ResultWriter::writeMeshSTLTopology | ( | std::vector< Node > & | nodes, |
std::vector< Element * > & | elements | ||
) |
Writes the mesh stl topology to the result file (all points and polygons needed to represent the cross-section)
nodes | vector containing all nodes in cross-section |
elements | vector containing all elements in cross-section |
void ResultWriter::writeMeshTopology | ( | std::vector< Node > & | nodes, |
std::vector< Element * > & | elements | ||
) |
Writes the mesh topology to the result file (all points and polygons needed to represent the cross-section)
nodes | vector containing all nodes in cross-section |
elements | vector containing all elements in cross-section |
void ResultWriter::writePointScalarData | ( | std::string | name, |
MatrixXd | data | ||
) |
Writes scalar data to the result VTK file.
Scalar data in .vtk is formatted as:
SCALARS name double 1
LOOKUP_TABLE default
\( \textbf{double} \quad data_1 \)
\( \textbf{double} \quad data_2 \)
...
\( \textbf{double} \quad data_n \)
name | string naming the scalar dataset |
data | data values for the scalar table |
void ResultWriter::writePointVectorData | ( | std::string | name, |
MatrixXd | data | ||
) |
Writes vector data to the result VTK file.
Vector data in .vtk is formatted as:
VECTORS name double
\( \textbf{double} \quad data_{11} \quad , \quad \textbf{double} \quad data_{12} \quad , \quad \textbf{double} \quad data_{13} \)
\( \textbf{double} \quad data_{21} \quad , \quad \textbf{double} \quad data_{22} \quad , \quad \textbf{double} \quad data_{23} \)
...
\( \textbf{double} \quad data_{n1} \quad , \quad \textbf{double} \quad data_{n2} \quad , \quad \textbf{double} \quad data_{n3} \)
name | string naming the scalar dataset |
data | data values for the scalar table |
void ResultWriter::writeShearCenter | ( | std::string | name, |
int | size | ||
) |
Applies a VTK box glyph at the shear center.
name | names the data in the result VTK file |
size | number of nodes in the cross-section |
void ResultWriter::writeVtkHeader | ( | ) |
writes the header for the .vtk file
The header has the following format:
vtk DataFile Version 4.0
fileName
ASCII