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