00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::Histogram 00026 00027 Description 00028 Calculates the counts per bin of a list. 00029 00030 SourceFiles 00031 Histogram.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef Histogram_H 00036 #define Histogram_H 00037 00038 #include <OpenFOAM/labelList.H> 00039 00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00041 00042 namespace Foam 00043 { 00044 00045 00046 /*---------------------------------------------------------------------------*\ 00047 Class Histogram Declaration 00048 \*---------------------------------------------------------------------------*/ 00049 00050 template<class List> 00051 class Histogram 00052 { 00053 // Private data 00054 00055 //- Counts per bin 00056 labelList counts_; 00057 00058 //- Number of <= lowest bin 00059 label nLow_; 00060 00061 //- Number of > highest bin 00062 label nHigh_; 00063 00064 00065 // Private Member Functions 00066 00067 void count(const List& bins, const List& l); 00068 00069 //- Disallow default bitwise copy construct 00070 Histogram(const Histogram&); 00071 00072 //- Disallow default bitwise assignment 00073 void operator=(const Histogram&); 00074 00075 00076 public: 00077 00078 // Constructors 00079 00080 //- Construct given bin values and input list 00081 Histogram(const List& bins, const List& l); 00082 00083 //- Construct given min, max, number of bins and input list 00084 Histogram 00085 ( 00086 const typename List::const_reference min, 00087 const typename List::const_reference max, 00088 const label nBins, 00089 const List& l 00090 ); 00091 00092 00093 // Access 00094 00095 //- Return the counts per bin 00096 inline const labelList& counts() const 00097 { 00098 return counts_; 00099 } 00100 00101 //- Return the number of elements <= bins[0] 00102 // (so inclusive lowest bin value) 00103 inline label nLow() const 00104 { 00105 return nLow_; 00106 } 00107 00108 //- Return the number of elements > bins[bins.size()-1] 00109 // (so exclusive highest bin value) 00110 inline label nHigh() const 00111 { 00112 return nHigh_; 00113 } 00114 }; 00115 00116 00117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00118 00119 } // End namespace Foam 00120 00121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00122 00123 //# include <ODE/HistogramI.H> 00124 00125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00126 00127 #ifdef NoRepository 00128 # include <OpenFOAM/Histogram.C> 00129 #endif 00130 00131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00132 00133 #endif 00134 00135 // ************************ vim: set sw=4 sts=4 et: ************************ //