Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes | List of all members
ResultWriter Class Reference

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.
 

Detailed Description

Writes results to file for massive analysis.

Resultwriter is responsible for writing data to file. It also contains definitions and the structure of results.

Constructor & Destructor Documentation

ResultWriter::ResultWriter ( std::string  fileName,
Mesh  mesh 
)

Constructor taking the filename and mesh as parameters.

Parameters
fileNamefileName of .msh file with folder extension
meshthe mesh that has been analyzed

Member Function Documentation

void ResultWriter::createTextFile ( std::string  fileNameNoExt)

Creates a .txt file.

Outputs applied loads, cross-sectional parameters and stiffnesses

Parameters
fileNameNoExtthe 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.

Parameters
namestring naming the data in the result VTK file
sizethe 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)

Parameters
nodesvector containing all nodes in cross-section
elementsvector 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)

Parameters
nodesvector containing all nodes in cross-section
elementsvector 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 \)

Parameters
namestring naming the scalar dataset
datadata 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} \)

Parameters
namestring naming the scalar dataset
datadata values for the scalar table
void ResultWriter::writeShearCenter ( std::string  name,
int  size 
)

Applies a VTK box glyph at the shear center.

Parameters
namenames the data in the result VTK file
sizenumber 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


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