equalBinWidth.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) 2022 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::histogramModels::equalBinWidth
28 
29 Description
30  Histogram model which groups data into bins of equal width.
31 
32 Usage
33  Minimal example by using \c system/controlDict.functions:
34  \verbatim
35  histogram1
36  {
37  // Inherited entries
38  ...
39 
40  // Mandatory entries
41  nBins <label>;
42 
43  // Optional entries
44  min <scalar>;
45  max <scalar>;
46  }
47  \endverbatim
48 
49  where the entries mean:
50  \table
51  Property | Description | Type | Reqd | Deflt
52  nBins | Number of histogram bins | label | yes | -
53  min | Minimum value of histogram data | scalar | no | -
54  max | Maximum value of histogram data | scalar | no | -
55  \endtable
56 
57 Note
58  - If \c max is not provided, \c histogram will use operand
59  field's min and max as the bin extremes.
60  - If \c max is provided without \c min,
61  \c histogram will use 0 for the \c min.
62 
63 SourceFiles
64  equalBinWidth.C
65 
66 \*---------------------------------------------------------------------------*/
67 
68 #ifndef Foam_histogramModels_equalBinWidth_H
69 #define Foam_histogramModels_equalBinWidth_H
70 
71 #include "histogramModel.H"
72 #include "MinMax.H"
73 
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 
76 namespace Foam
77 {
78 namespace histogramModels
79 {
80 
81 /*---------------------------------------------------------------------------*\
82  Class equalBinWidth Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 class equalBinWidth
86 :
87  public histogramModel
88 {
89  // Private Data
90 
91  //- Number of bins
92  label nBins_;
93 
94  //- Min/max for histogram data
95  scalarMinMax range_;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("equalBinWidth");
102 
103 
104  // Constructors
105 
106  //- Construct from components
108  (
109  const word& name,
110  const fvMesh& mesh,
111  const dictionary& dict
112  );
113 
114  //- No copy construct
115  equalBinWidth(const equalBinWidth&) = delete;
116 
117  //- No copy assignment
118  void operator=(const equalBinWidth&) = delete;
119 
120 
121  // Destructor
122  virtual ~equalBinWidth() = default;
123 
124 
125  // Member Functions
126 
127  //- Read top-level dictionary
128  virtual bool read(const dictionary& dict);
129 
130  //- Write data to stream and files
131  virtual bool write(const bool log);
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace histogramModels
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
dictionary dict
Histogram model which groups data into bins of equal width.
MinMax< scalar > scalarMinMax
A scalar min/max range.
Definition: MinMax.H:97
dimensionedScalar log(const dimensionedScalar &ds)
virtual bool read(const dictionary &dict)
Read top-level dictionary.
Definition: equalBinWidth.C:57
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
equalBinWidth(const word &name, const fvMesh &mesh, const dictionary &dict)
Construct from components.
Definition: equalBinWidth.C:41
void operator=(const equalBinWidth &)=delete
No copy assignment.
const fvMesh & mesh() const noexcept
Return const reference to the mesh.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual bool write(const bool log)
Write data to stream and files.
Definition: equalBinWidth.C:84
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
TypeName("equalBinWidth")
Runtime type information.
Namespace for OpenFOAM.