|
|
|
Histogram.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2009 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 the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 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, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 Foam::Histogram 00027 00028 Description 00029 Calculates the counts per bin of a list. 00030 00031 SourceFiles 00032 Histogram.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef Histogram_H 00037 #define Histogram_H 00038 00039 #include "labelList.H" 00040 00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00042 00043 namespace Foam 00044 { 00045 00046 00047 /*---------------------------------------------------------------------------*\ 00048 Class Histogram Declaration 00049 \*---------------------------------------------------------------------------*/ 00050 00051 template<class List> 00052 class Histogram 00053 { 00054 // Private data 00055 00056 //- Counts per bin 00057 labelList counts_; 00058 00059 //- Number of <= lowest bin 00060 label nLow_; 00061 00062 //- Number of > highest bin 00063 label nHigh_; 00064 00065 00066 // Private Member Functions 00067 00068 void count(const List& bins, const List& l); 00069 00070 //- Disallow default bitwise copy construct 00071 Histogram(const Histogram&); 00072 00073 //- Disallow default bitwise assignment 00074 void operator=(const Histogram&); 00075 00076 00077 public: 00078 00079 // Constructors 00080 00081 //- Construct given bin values and input list 00082 Histogram(const List& bins, const List& l); 00083 00084 //- Construct given min, max, number of bins and input list 00085 Histogram 00086 ( 00087 const typename List::const_reference min, 00088 const typename List::const_reference max, 00089 const label nBins, 00090 const List& l 00091 ); 00092 00093 00094 // Access 00095 00096 //- Return the counts per bin 00097 inline const labelList& counts() const 00098 { 00099 return counts_; 00100 } 00101 00102 //- Return the number of elements <= bins[0] 00103 // (so inclusive lowest bin value) 00104 inline label nLow() const 00105 { 00106 return nLow_; 00107 } 00108 00109 //- Return the number of elements > bins[bins.size()-1] 00110 // (so exclusive highest bin value) 00111 inline label nHigh() const 00112 { 00113 return nHigh_; 00114 } 00115 }; 00116 00117 00118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00119 00120 } // End namespace Foam 00121 00122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00123 00124 //# include "HistogramI.H" 00125 00126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00127 00128 #ifdef NoRepository 00129 # include "Histogram.C" 00130 #endif 00131 00132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00133 00134 #endif 00135 00136 // ************************************************************************* // |