preCICE v3.1.1
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
precice::io::TXTTableWriter Class Reference

File writer for table-data in text-format. More...

#include <TXTTableWriter.hpp>

Collaboration diagram for precice::io::TXTTableWriter:
[legend]

Classes

struct  Data
 Represents one data entry to be written. More...
 

Public Types

enum  DataType { INT , DOUBLE , VECTOR2D , VECTOR3D }
 Constants defining possible data types to be written. More...
 

Public Member Functions

 TXTTableWriter (const std::string &filename)
 Constructor, opens file.
 
void addData (const std::string &name, DataType type)
 Adds a data entry to the table.
 
void writeData (const std::string &name, int value)
 Writes a integral scalar data value associated to the entry name.
 
void writeData (const std::string &name, double value)
 Writes a floating-point scalar data value associated to the entry name.
 
void writeData (const std::string &name, const Eigen::Vector2d &value)
 Writes a vector data value associated to the entry name.
 
void writeData (const std::string &name, const Eigen::Vector3d &value)
 
void close ()
 Closes the file, is automatically called on destruction.
 
void reset ()
 Resets the table information.
 

Private Attributes

logging::Logger _log {"io::TXTTableWriter"}
 
std::vector< Data_data
 
std::vector< Data >::const_iterator _writeIterator
 
std::ofstream _outputStream
 

Detailed Description

File writer for table-data in text-format.

Usage: Create the writer, add data entries in the wanted sequence, and write data values cyclically in the same sequence.

Definition at line 19 of file TXTTableWriter.hpp.

Member Enumeration Documentation

◆ DataType

Constants defining possible data types to be written.

Enumerator
INT 
DOUBLE 
VECTOR2D 
VECTOR3D 

Definition at line 22 of file TXTTableWriter.hpp.

Constructor & Destructor Documentation

◆ TXTTableWriter()

precice::io::TXTTableWriter::TXTTableWriter ( const std::string & filename)
explicit

Constructor, opens file.

Definition at line 10 of file TXTTableWriter.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addData()

void precice::io::TXTTableWriter::addData ( const std::string & name,
DataType type )

Adds a data entry to the table.

Depending on the type and dimension, several text-columns might be added. The writeData() method has to be called in the order in which data entries are added.

Definition at line 24 of file TXTTableWriter.cpp.

Here is the call graph for this function:

◆ close()

void precice::io::TXTTableWriter::close ( )

Closes the file, is automatically called on destruction.

Definition at line 149 of file TXTTableWriter.cpp.

Here is the call graph for this function:

◆ reset()

void precice::io::TXTTableWriter::reset ( )

Resets the table information.

Definition at line 156 of file TXTTableWriter.cpp.

◆ writeData() [1/4]

void precice::io::TXTTableWriter::writeData ( const std::string & name,
const Eigen::Vector2d & value )

Writes a vector data value associated to the entry name.

The write order is fixed by the order addData() is called.

Definition at line 100 of file TXTTableWriter.cpp.

Here is the call graph for this function:

◆ writeData() [2/4]

void precice::io::TXTTableWriter::writeData ( const std::string & name,
const Eigen::Vector3d & value )

Definition at line 125 of file TXTTableWriter.cpp.

Here is the call graph for this function:

◆ writeData() [3/4]

void precice::io::TXTTableWriter::writeData ( const std::string & name,
double value )

Writes a floating-point scalar data value associated to the entry name.

The write order is fixed by the order addData() is called.

Definition at line 79 of file TXTTableWriter.cpp.

Here is the call graph for this function:

◆ writeData() [4/4]

void precice::io::TXTTableWriter::writeData ( const std::string & name,
int value )

Writes a integral scalar data value associated to the entry name.

The write order is fixed by the order addData() is called.

Definition at line 58 of file TXTTableWriter.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _data

std::vector<Data> precice::io::TXTTableWriter::_data
private

Definition at line 96 of file TXTTableWriter.hpp.

◆ _log

logging::Logger precice::io::TXTTableWriter::_log {"io::TXTTableWriter"}
private

Definition at line 94 of file TXTTableWriter.hpp.

◆ _outputStream

std::ofstream precice::io::TXTTableWriter::_outputStream
private

Definition at line 100 of file TXTTableWriter.hpp.

◆ _writeIterator

std::vector<Data>::const_iterator precice::io::TXTTableWriter::_writeIterator
private

Definition at line 98 of file TXTTableWriter.hpp.


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