unequalBinWidth.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::unequalBinWidth
28 
29 Description
30  Histogram model which groups data into bins of unequal widths.
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  ranges
42  (
43  // min max
44  (<scalar> <scalar>) // bin-0
45  (<scalar> <scalar>) // bin-1
46  ...
47  );
48  }
49  \endverbatim
50 
51  where the entries mean:
52  \table
53  Property | Description | Type | Reqd | Deflt
54  ranges | Min-max values of histogram data <!--
55  --> | List<scalarMinMax> | no | -
56  \endtable
57 
58 Note
59  - All bins are half-open, that is [min, max).
60  - Bins should be specified as consecutive, non-overlapping
61  and adjacent intervals of the field variable. No warning
62  or runtime error will be emitted, otherwise.
63 
64 SourceFiles
65  unequalBinWidth.C
66 
67 \*---------------------------------------------------------------------------*/
68 
69 #ifndef Foam_histogramModels_unequalBinWidth_H
70 #define Foam_histogramModels_unequalBinWidth_H
71 
72 #include "histogramModel.H"
73 #include "MinMax.H"
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 namespace Foam
78 {
79 namespace histogramModels
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class unequalBinWidth Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 class unequalBinWidth
87 :
88  public histogramModel
89 {
90  // Private Data
91 
92  //- Number of bins
93  label nBins_;
94 
95  //- Lower and upper ranges of operand bins
96  List<scalarMinMax> ranges_;
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("unequalBinWidth");
103 
104 
105  // Constructors
106 
107  //- Construct from components
109  (
110  const word& name,
111  const fvMesh& mesh,
112  const dictionary& dict
113  );
114 
115  //- No copy construct
116  unequalBinWidth(const unequalBinWidth&) = delete;
117 
118  //- No copy assignment
119  void operator=(const unequalBinWidth&) = delete;
120 
121 
122  // Destructor
123  virtual ~unequalBinWidth() = default;
124 
125 
126  // Member Functions
127 
128  //- Read top-level dictionary
129  virtual bool read(const dictionary& dict);
130 
131  //- Write data to stream and files
132  virtual bool write(const bool log);
133 };
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace histogramModels
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
dictionary dict
dimensionedScalar log(const dimensionedScalar &ds)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
const fvMesh & mesh() const noexcept
Return const reference to the mesh.
void operator=(const unequalBinWidth &)=delete
No copy assignment.
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.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
TypeName("unequalBinWidth")
Runtime type information.
Histogram model which groups data into bins of unequal widths.
virtual bool read(const dictionary &dict)
Read top-level dictionary.
unequalBinWidth(const word &name, const fvMesh &mesh, const dictionary &dict)
Construct from components.
Namespace for OpenFOAM.