KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
logger_table_output.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Pooyan Dadvand
11 //
12 //
13 
14 
15 #if !defined(KRATOS_LOGGER_TABLE_OUTPUT_H_INCLUDED )
16 #define KRATOS_LOGGER_TABLE_OUTPUT_H_INCLUDED
17 
18 
19 
20 // System includes
21 #include <string>
22 #include <iostream>
23 #include <vector>
24 
25 
26 // External includes
27 
28 
29 // Project includes
32 
33 namespace Kratos
34 {
37 
40 
42 
45 class KRATOS_API(KRATOS_CORE) LoggerTableOutput : public LoggerOutput
46 {
47 public:
50 
51 
55 
59 
60  LoggerTableOutput(Parameters rSettings);
61  LoggerTableOutput(std::ostream& rMyStream, Parameters rSettings);
63 
65  virtual ~LoggerTableOutput() {}
66 
67 
71 
73 
77 
78 
82 
83 
84  void WriteHeader() override;
85 
86  void WriteMessage(LoggerMessage const& TheMessage) override;
87 
91 
95 
97  std::string Info() const override;
98 
100  void PrintInfo(std::ostream& rOStream) const override;
101 
103  void PrintData(std::ostream& rOStream) const override;
104 
105 
107 
108 private:
111 
115 
116  std::size_t mCurrentColumnIndex;
117  std::vector<std::string> mColumnsHeaders;
118  std::vector<std::size_t> mColumnsWidth;
119  std::vector<std::string> mColumnsTexts;
120  std::vector<std::string> mColumnsLabels;
121  std::ofstream mMyFileStream;
122  bool mHeaderIsWritten = false;
123  std::string mFileHeader;
124  std::string mIdLabel;
125 
129  void ApplySettings(Parameters rSettings);
130  void MoveCursorToColumn(std::size_t ColumnIndex);
131 
132  void WriteHashLine();
133  void WriteTableLine();
134  std::string Centered(int width, const std::string& str);
135  void StripLabels(std::string& inLabel, std::string& outGlobalLabel, std::string& outColumnLabel);
136 
138 }; // Class LoggerTableOutput
139 
141 
144 
146 std::ostream& operator << (std::ostream& rOStream,
147  const LoggerTableOutput& rThis);
148 
152 
153 
155 
157 } // namespace Kratos.
158 
159 #endif // KRATOS_LOGGER_TABLE_OUTPUT_H_INCLUDED defined
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
LoggerMessage class holdes message and the properties of the message.
Definition: logger_message.h:53
LoggerOutput is the base class for all logger outputs.
Definition: logger_output.h:48
LoggerTableOutput takes columns names and only prints the messages with lable given with column name.
Definition: logger_table_output.h:46
virtual ~LoggerTableOutput()
Destructor.
Definition: logger_table_output.h:65
LoggerTableOutput & operator=(LoggerTableOutput const &Other)=delete
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
str
Definition: generate_gid_list_file.py:35