preCICE v3.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TXTTableWriterTest.cpp
Go to the documentation of this file.
1#include <Eigen/Core>
4#include "testing/Testing.hpp"
5
7
8using namespace precice::io;
9
11BOOST_AUTO_TEST_CASE(TXTTableWriterTest)
12{
14 TXTTableWriter writer("io-TXTTableWriterTest.log");
15 writer.addData("Timestep", TXTTableWriter::INT);
16 writer.addData("Flowrate", TXTTableWriter::DOUBLE);
17 writer.addData("Force2D", TXTTableWriter::VECTOR2D);
18 writer.addData("Force3D", TXTTableWriter::VECTOR3D);
19
20 for (int t = 0; t < 10; t++) {
21 writer.writeData("Timestep", t);
22 writer.writeData("Flowrate", 0.0 + (double) t);
23 writer.writeData("Force2D", Eigen::Vector2d(0.0 + 2.0 * (double) t,
24 0.0 + 2.0 * (double) t));
25 writer.writeData("Force3D", Eigen::Vector3d(0.0 + 2.0 * (double) t,
26 0.0 + 2.0 * (double) t,
27 0.0 + 2.0 * (double) t));
28 }
29 writer.reset();
30
31 writer.addData("Timestep", TXTTableWriter::INT);
32 writer.addData("Importance", TXTTableWriter::INT);
33
34 for (int t = 0; t < 10; t++) {
35 writer.writeData("Timestep", t);
36 writer.writeData("Importance", t * 2);
37 }
38 writer.close();
39}
40
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TXTTableWriterTest)
#define PRECICE_TEST()
Definition Testing.hpp:39
#define PRECICE_TEST_SETUP(...)
Creates and attaches a TestSetup to a Boost test case.
Definition Testing.hpp:29
File writer for table-data in text-format.
void close()
Closes the file, is automatically called on destruction.
void addData(const std::string &name, DataType type)
Adds a data entry to the table.
void reset()
Resets the table information.
void writeData(const std::string &name, int value)
Writes a integral scalar data value associated to the entry name.
provides Import and Export of the coupling mesh and data.