preCICE v3.1.1
Loading...
Searching...
No Matches
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
10BOOST_AUTO_TEST_CASE(TXTTableWriterTest)
11{
12 PRECICE_TEST(1_rank);
13 TXTTableWriter writer("io-TXTTableWriterTest.log");
14 writer.addData("Timestep", TXTTableWriter::INT);
15 writer.addData("Flowrate", TXTTableWriter::DOUBLE);
16 writer.addData("Force2D", TXTTableWriter::VECTOR2D);
17 writer.addData("Force3D", TXTTableWriter::VECTOR3D);
18
19 for (int t = 0; t < 10; t++) {
20 writer.writeData("Timestep", t);
21 writer.writeData("Flowrate", 0.0 + (double) t);
22 writer.writeData("Force2D", Eigen::Vector2d(0.0 + 2.0 * (double) t,
23 0.0 + 2.0 * (double) t));
24 writer.writeData("Force3D", Eigen::Vector3d(0.0 + 2.0 * (double) t,
25 0.0 + 2.0 * (double) t,
26 0.0 + 2.0 * (double) t));
27 }
28 writer.reset();
29
30 writer.addData("Timestep", TXTTableWriter::INT);
31 writer.addData("Importance", TXTTableWriter::INT);
32
33 for (int t = 0; t < 10; t++) {
34 writer.writeData("Timestep", t);
35 writer.writeData("Importance", t * 2);
36 }
37 writer.close();
38}
39
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TXTTableWriterTest)
#define PRECICE_TEST(...)
Definition Testing.hpp:27
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.