PrintTable.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2012-2015 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  // Private Member Functions
84 
85  //- Disallow default bitwise assignment
86  void operator=(const PrintTable<KeyType, DataType>&);
87 
88 
89 public:
90 
91  // Constructors
92 
93  //- Null constructor
94  PrintTable();
95 
96  //- Construct with a title
97  explicit PrintTable(const string& title);
98 
99  //- Copy constructor
101 
102 
103  //- Destructor
104  ~PrintTable();
105 
106 
107  // Member Functions
108 
109  //- Add an entry (D) to the given key(K)
110  void add(const KeyType& K, const DataType& D);
111 
112  //- Print the table
113  void print
114  (
115  Ostream& os,
116  const bool printSum = false,
117  const bool printAverage = false
118  ) const;
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 print(Ostream &os, const bool printSum=false, const bool printAverage=false) const
Print the table.
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 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.