My Project
Public Member Functions | Public Attributes | List of all members
ResultWriter Class Reference

Opens and writes results to file. More...

#include <ResultWriter.h>

Public Member Functions

 ResultWriter (std::string, Mesh mesh)
 Constructor taking the filename and mesh as parameters.
 
bool open ()
 Opens the file given by the filename.
 
void save ()
 Closes the file.
 
void writeNormalStress ()
 Writes the normal stresses to the result VTK file.
 
void writeMomentStress (std::vector< Node >, int)
 Writes moment stresses to the result VTK file. More...
 
void writeInertialAxes ()
 Writes the angle of one of the inertial axes to file.
 
void writeMeshAreaProperties ()
 Writes mesh properties to result file. More...
 
void writeScalarData (std::string, std::vector< double >)
 Writes scalar data.
 
void writeSingleValue (std::string, double)
 Writes single value.
 
void writeBoundaryNodes (int, std::vector< int >)
 Writes the boundary nodes to the VTK result file.
 
void writeVtkHeader ()
 Writes header for result VTK file, with version information.
 
void writeMeshTopology (std::vector< Node > &nodes, std::vector< Element * > &elements)
 Writes the mesh topology to the result file.
 
void writePointScalarData (std::string name, MatrixXd data)
 Writes Scalar values to result VTK file.
 
void writePointVectorData (std::string name, MatrixXd data)
 Writes point vector data to result VTK file.
 

Public Attributes

bool writeSTL
 Boolean that decides wether to write regular VTK format or STL format.
 

Detailed Description

Opens and writes results to file.

Resultwriter is responsible for opening and write data to file. It also contains definitions and the structure of results. Most of the calculations is done in Mesh and Solver, and only calculations regarding mapping a force to a specific element or node performed in this class.

Member Function Documentation

void ResultWriter::writeMeshAreaProperties ( )

Writes mesh properties to result file.

Result tag "#MeshProperties"

Properties written:

  • Area centre,
  • Total area,
  • Shear centre,
  • Moment of inertia-X,
  • Moment of inertia-Y,
  • Moment of inertia product
void ResultWriter::writeMomentStress ( std::vector< Node nodes,
int  nLength 
)

Writes moment stresses to the result VTK file.

Calculate stresses caused by an unit moment about the inertal axis

Result tag "#Sigma due to M_x"
Result tag "#Sigma due to M_y"

It first creates a unit vector along the inertial axis. Using vector algebra to calculate the distance from the inertial axis to the each node.
\( y = || (\vec{a - p}) - ((\vec{a - p}) \cdot \vec{n})\vec{n}|| \)

Force in a node is given by
\( \sigma = \frac{M}{I}\cdot y \),
where y is the distance calculated above.
The result written by this method is based on a unit moment(M = 1).

Parameters
Vector<Node>containing stresses in x,y direction for all nodes
IntegerNumber of nodes in vector
Meshreference to mesh class containing the data

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