decompositionInformation.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) 2017 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::decompositionInformation
28 
29 Description
30  Abstract base class for decomposition
31 
32 SourceFiles
33  decompositionInformation.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef decompositionInformation_H
38 #define decompositionInformation_H
39 
40 #include "polyMesh.H"
41 #include "CompactListList.H"
42 #include "IOstreams.H"
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class decompositionInformation Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 {
53  //- Simple storage for organizing min/max/median quantities
54  struct stats
55  {
56  label min;
57  label max;
58  label median;
59 
60  stats() : min(0), max(0), median(0) {}
61 
62  void clear()
63  {
64  min = 0;
65  max = 0;
66  median = 0;
67  }
68 
69  Ostream& print(Ostream& os) const;
70  };
71 
72  // Private data
73 
74  labelListList distrib_;
75  label nDomains_;
76 
77  stats cellsInfo_;
78  stats neighInfo_;
79  stats facesInfo_;
80 
81 
82  // Private Member Functions
83 
84  //- Populate from cell decomposition list
85  void populate
86  (
87  const labelUList& adjncy,
88  const labelUList& xadj,
89  const labelUList& decomp,
90  const label nDomains
91  );
92 
93  //- No copy construct
95 
96  //- No copy assignment
97  void operator=(const decompositionInformation&) = delete;
98 
99 
100 public:
101 
102  // Constructors
103 
104  //- Construct
106  (
107  const labelUList& adjncy,
108  const labelUList& xadj,
109  const labelUList& decomp,
110  const label nDomains
111  );
112 
113  //- Construct
115  (
116  const CompactListList<label>& cellCells,
117  const labelUList& decomp,
118  const label nDomains
119  );
120 
121 
122  //- Destructor
123  ~decompositionInformation() = default;
124 
125 
126  // Member Functions
127 
128  void clear();
129 
130  label nDomains() const noexcept
131  {
132  return nDomains_;
133  }
134 
135  void printSummary(Ostream& os) const;
136 
137  void printDetails(Ostream& os) const;
138 
139  void printAll(Ostream& os) const;
140 };
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #endif
150 
151 // ************************************************************************* //
Abstract base class for decomposition.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
Definition: BitOps.H:323
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
A packed storage of objects of type <T> using an offset table for access.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
OBJstream os(runTime.globalPath()/outputName)
~decompositionInformation()=default
Destructor.
Namespace for OpenFOAM.