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.
counter.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: Riccardo Rossi
11 //
12 //
13 
14 
15 
16 #if !defined(KRATOS_COUNTER_H_INCLUDED )
17 #define KRATOS_COUNTER_H_INCLUDED
18 
19 
20 
21 // System includes
22 #include <string>
23 #include <iostream>
24 
25 
26 // External includes
27 
28 
29 // Project includes
30 #include "includes/define.h"
31 
32 
33 namespace Kratos
34 {
35 
38 
42 
46 
50 
54 
56 
58 template<class TCountedType>
59 class Counter
60 {
61 public:
64 
67 
68  typedef unsigned int SizeType;
69 
73 
74 
78 
79 
83 
84 
88 
89  // return counter
91  {
93  }
94 
95  // return counter
97  {
99  }
100 
104 
105 
109 
111  virtual std::string Info() const
112  {
113  return std::string("Counter");
114  }
115 
117  virtual void PrintInfo(std::ostream& rOStream) const
118  {
119  rOStream << Info();
120  }
121 
123  virtual void PrintData(std::ostream& rOStream) const
124  {
125  rOStream << Counter();
126  }
127 
128 
132 
133 
135 
136 protected:
139 
140 
144 
145 
149 
150 
154 
155 
159 
160 
164 
165 
169 
172  {
173  }
174 
177  {
178  }
179 
181  virtual ~Counter()
182  {
183  }
184 
186 
187 private:
190 
192  static SizeType msCounter;
193 
197 
198 
202 
203 
207 
208 
212 
213 
217 
218 
222 
224  Counter& operator=(Counter const& rOther);
225 
227 
228 }; // Class Counter
229 
231 
234 
235 
239 
240 
242 template<class TCountedType>
243 inline std::istream& operator >> (std::istream& rIStream,
244  Counter<TCountedType>& rThis);
245 
247 template<class TCountedType>
248 inline std::ostream& operator << (std::ostream& rOStream,
249  const Counter<TCountedType>& rThis)
250 {
251  rThis.PrintInfo(rOStream);
252  rOStream << " : ";
253  rThis.PrintData(rOStream);
254 
255  return rOStream;
256 }
258 
259 // initialize counter with zero
260 template<typename TCountedType>
261 typename Counter<TCountedType>::SizeType Counter<TCountedType>::msCounter = 0;
262 
263 } // namespace Kratos.
264 
265 #endif // KRATOS_COUNTER_H_INCLUDED defined
266 
267 
Short class definition.
Definition: counter.h:60
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: counter.h:123
virtual ~Counter()
Destructor.
Definition: counter.h:181
Counter()
Default constructor.
Definition: counter.h:171
unsigned int SizeType
Definition: counter.h:68
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: counter.h:117
static SizeType Increment()
Definition: counter.h:96
virtual std::string Info() const
Turn back information as a string.
Definition: counter.h:111
KRATOS_CLASS_POINTER_DEFINITION(Counter)
Pointer definition of Counter.
Counter(Counter< TCountedType > const &rOther)
Copy constructor.
Definition: counter.h:176
static SizeType GetCounter()
Definition: counter.h:90
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432