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.
table_stream_utility.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: Vicente Mataix Ferrandiz
11 //
12 //
13 
14 #if !defined(KRATOS_TABLE_STREAM_UTILITY)
15 #define KRATOS_TABLE_STREAM_UTILITY
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
22 #include "includes/serializer.h"
23 #include "includes/table_stream.h"
24 
25 namespace Kratos
26 {
29 
33 
35 
39 
43 
45 {
46 public:
49 
52 
56 
57  // Class Constructor
62  explicit TableStreamUtility(const bool UseBoldFont = true):
63  mTable(&std::cout, "|", UseBoldFont)
64  {
65  }
66 
67  virtual ~TableStreamUtility()= default;
68 
72 
76 
80 
84 
88 
93  void PrintHeader()
94  {
95  mTable.PrintHeader();
96  }
97 
102  void PrintFooter()
103  {
104  mTable.PrintFooter();
105  }
106 
111  template<class TClass>
112  void AddToRow(TClass ThisClass)
113  {
114  mTable << ThisClass;
115  }
116 
123  void AddColumn(const std::string& ThisName, unsigned int ThisSpaces)
124  {
125  mTable.AddColumn(ThisName, ThisSpaces);
126  }
127 
134  {
135  return mTable;
136  }
137 
139  virtual std::string Info() const
140  {
141  return "TableStreamUtility";
142  }
143 
145  virtual void PrintInfo(std::ostream& rOStream) const
146  {
147  rOStream << Info() << std::endl;
148  }
149 
151  virtual void PrintData(std::ostream& rOStream) const
152  {
153  rOStream << Info() << std::endl;
154  }
155 
156 protected:
157 
160 
164 
168 
172 
176 
180 
185 
186 private:
192 
193  TableStreamType mTable;
194 
198 
202 
207 
211 
212  friend class Serializer;
213 
214  void save(Serializer& rSerializer) const
215  {
216  rSerializer.save("Table", mTable);
217  }
218 
219  void load(Serializer& rSerializer)
220  {
221  rSerializer.load("Table", mTable);
222  }
223 
227 
231 };// class TableStreamUtility
232 
236 
237 
241 
243 
244 } // namespace Kratos.
245 #endif /* KRATOS_TABLE_STREAM_UTILITY defined */
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
This is a fancy table to stream data in a fancy way.
Definition: table_stream.h:64
Definition: table_stream_utility.h:45
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: table_stream_utility.h:145
void AddToRow(TClass ThisClass)
Definition: table_stream_utility.h:112
virtual std::string Info() const
Turn back information as a string.
Definition: table_stream_utility.h:139
void PrintHeader()
Definition: table_stream_utility.h:93
KRATOS_CLASS_POINTER_DEFINITION(TableStreamUtility)
Counted pointer of TableStreamUtility.
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: table_stream_utility.h:151
void PrintFooter()
Definition: table_stream_utility.h:102
virtual ~TableStreamUtility()=default
TableStreamType & GetTable()
Definition: table_stream_utility.h:133
void AddColumn(const std::string &ThisName, unsigned int ThisSpaces)
Definition: table_stream_utility.h:123
TableStreamUtility(const bool UseBoldFont=true)
Definition: table_stream_utility.h:62
void AddColumn(const std::string &HeaderName, const int ColumnWidth)
Add a column to our table.
Definition: table_stream.h:220
void PrintHeader()
This function prints the header of the stream.
Definition: table_stream.h:235
void PrintFooter()
This function prints the footer of the stream.
Definition: table_stream.h:277
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TableStream TableStreamType
Definition: table_stream_utility.h:34
def load(f)
Definition: ode_solve.py:307
namespace
Definition: array_1d.h:793