PrintTable.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::PrintTable
26 
27 Description
28  Print a table in parallel, e.g.;
29 
30  \verbatim
31  Vertex Type Information
32  Proc # 0 1 2 3
33  Total 145680 145278 145751 145359
34  Unassigned 0 0 0 0
35  nExternalFeatureEdge 883 829 828 960
36  nExternalFeaturePoint 8 10 10 12
37  nExternalSurface 9533 9488 9502 9482
38  nFar 0 0 0 0
39  nInternal 125494 125198 125642 125174
40  nInternalFeatureEdge 238 241 241 240
41  nInternalFeaturePoint 2 2 2 2
42  nInternalNearBoundary 0 0 0 0
43  nInternalSurface 9522 9510 9526 9489
44  nReferred 7545 7497 7500 7587
45  \endverbatim
46 
47 SourceFiles
48  PrintTableI.H
49  PrintTable.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef PrintTable_H
54 #define PrintTable_H
55 
56 #include "HashTable.H"
57 #include "Ostream.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class PrintTable Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<class KeyType, class DataType>
69 class PrintTable
70 {
72 
73 
74  // Private Data
75 
76  //- Hash table holding the data
77  HashTableData table_;
78 
79  //- Title of the table
80  string title_;
81 
82 
83 public:
84 
85  // Constructors
86 
87  //- Null constructor
88  PrintTable();
89 
90  //- Construct with a title
91  explicit PrintTable(const string& title);
92 
93  //- Copy constructor
95 
96 
97  //- Destructor
98  ~PrintTable();
99 
100 
101  // Member Functions
102 
103  //- Add an entry (D) to the given key(K)
104  void add(const KeyType& K, const DataType& D);
105 
106  //- Print the table
107  void print
108  (
109  Ostream& os,
110  const bool printSum = false,
111  const bool printAverage = false
112  ) const;
113 
114 
115  // Member Operators
116 
117  //- Disallow default bitwise assignment
118  void operator=(const PrintTable<KeyType, DataType>&) = delete;
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #include "PrintTableI.H"
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #ifdef NoRepository
133  #include "PrintTable.C"
134 #endif
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
PrintTable()
Null constructor.
void operator=(const PrintTable< KeyType, DataType > &)=delete
Disallow default bitwise assignment.
CGAL::Exact_predicates_exact_constructions_kernel K
Print a table in parallel, e.g.;.
Definition: PrintTable.H:68
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void print(Ostream &os, const bool printSum=false, const bool printAverage=false) const
Print the table.
void add(const KeyType &K, const DataType &D)
Add an entry (D) to the given key(K)
Definition: PrintTableI.H:30
~PrintTable()
Destructor.
Namespace for OpenFOAM.