BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / OpenFOAM / containers / Lists / Histogram / Histogram.H
blob7cdf6ebda352f499fe73ea822630e9d103dca024
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Class
25     Foam::Histogram
27 Description
28     Calculates the counts per bin of a list.
30 SourceFiles
31     Histogram.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef Histogram_H
36 #define Histogram_H
38 #include "labelList.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 namespace Foam
46 /*---------------------------------------------------------------------------*\
47                           Class Histogram Declaration
48 \*---------------------------------------------------------------------------*/
50 template<class List>
51 class Histogram
53     // Private data
55         //- Counts per bin
56         labelList counts_;
58         //- Number of <= lowest bin
59         label nLow_;
61         //- Number of > highest bin
62         label nHigh_;
65     // Private Member Functions
67         void count(const List& bins, const List& l);
69         //- Disallow default bitwise copy construct
70         Histogram(const Histogram&);
72         //- Disallow default bitwise assignment
73         void operator=(const Histogram&);
76 public:
78     // Constructors
80         //- Construct given bin values and input list
81         Histogram(const List& bins, const List& l);
83         //- Construct given min, max, number of bins and input list
84         Histogram
85         (
86             const typename List::const_reference min,
87             const typename List::const_reference max,
88             const label nBins,
89             const List& l
90         );
93         // Access
95             //- Return the counts per bin
96             inline const labelList& counts() const
97             {
98                 return counts_;
99             }
101             //- Return the number of elements <= bins[0]
102             //  (so inclusive lowest bin value)
103             inline label nLow() const
104             {
105                 return nLow_;
106             }
108             //- Return the number of elements > bins[bins.size()-1]
109             //  (so exclusive highest bin value)
110             inline label nHigh() const
111             {
112                 return nHigh_;
113             }
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 } // End namespace Foam
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 //#   include "HistogramI.H"
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 #ifdef NoRepository
128 #   include "Histogram.C"
129 #endif
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 #endif
135 // ************************************************************************* //