Loading...
Searching...
No Matches
histogramModel.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-------------------------------------------------------------------------------
10License
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
26Namespace
27 Foam::histogramModels
28
29Description
30 A namespace for various histogram model implementations.
31
32Class
33 Foam::histogramModel
34
35Description
36 A base class for histogram models.
37
38SourceFiles
39 histogramModel.C
40 histogramModelNew.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef Foam_histogramModel_H
45#define Foam_histogramModel_H
46
47#include "writeFile.H"
48#include "volFields.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55// Forward Declarations
56class fvMesh;
57
58/*---------------------------------------------------------------------------*\
59 Class histogramModel Declaration
60\*---------------------------------------------------------------------------*/
61
63:
65{
66 // Private Data
67
68 //- Const reference to the mesh
69 const fvMesh& mesh_;
70
71 //- Name of operand field
72 word fieldName_;
73
74
75protected:
76
77 // Protected Member Functions
78
79 //- Output file header information
80 virtual void writeFileHeader(Ostream& os);
81
82 //- Return requested field from the object registry
83 //- or read+register the field to the object registry
85
86 //- Write histogram data
87 void write
88 (
89 scalarField& dataNormalised,
90 const labelField& dataCount,
91 const scalarField& magMidBin
92 );
93
94
95public:
96
97 //- Runtime type information
98 TypeName("histogramModel");
99
100
101 // Declare runtime constructor selection table
102
104 (
105 autoPtr,
108 (
109 const word& name,
110 const fvMesh& mesh,
112 ),
113 (name, mesh, dict)
114 );
115
116
117 // Selectors
118
119 //- Return a reference to the selected histogram model
121 (
122 const word& name,
123 const fvMesh& mesh,
124 const dictionary& dict
125 );
126
127
128 // Constructors
129
130 //- Construct from components
132 (
133 const word& name,
134 const fvMesh& mesh,
135 const dictionary& dict
136 );
137
138 //- No copy construct
139 histogramModel(const histogramModel&) = delete;
140
141 //- No copy assignment
142 void operator=(const histogramModel&) = delete;
143
144
145 //- Destructor
146 virtual ~histogramModel() = default;
147
148
149 // Member Functions
150
151 // Access
152
153 //- Return const reference to the mesh
154 const fvMesh& mesh() const noexcept { return mesh_; }
155
156 //- Return const reference to the operand field name
157 const word& fieldName() const noexcept { return fieldName_; }
159
160 // I-O
161
162 //- Read the function-object dictionary
163 virtual bool read(const dictionary& dict);
165 //- Write data to stream and files
166 virtual bool write(const bool log) = 0;
167};
168
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172} // End namespace Foam
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#endif
177
178// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Base class for writing single files from the function objects.
Definition writeFile.H:113
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
const fvMesh & mesh() const noexcept
Return const reference to the mesh.
declareRunTimeSelectionTable(autoPtr, histogramModel, dictionary,(const word &name, const fvMesh &mesh, const dictionary &dict),(name, mesh, dict))
volScalarField & getOrReadField(const word &fieldName) const
Return requested field from the object registry or read+register the field to the object registry.
void operator=(const histogramModel &)=delete
No copy assignment.
histogramModel(const histogramModel &)=delete
No copy construct.
TypeName("histogramModel")
Runtime type information.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
static autoPtr< histogramModel > New(const word &name, const fvMesh &mesh, const dictionary &dict)
Return a reference to the selected histogram model.
virtual void writeFileHeader(Ostream &os)
Output file header information.
virtual ~histogramModel()=default
Destructor.
const word & fieldName() const noexcept
Return const reference to the operand field name.
histogramModel(const word &name, const fvMesh &mesh, const dictionary &dict)
Construct from components.
virtual bool write(const bool log)=0
Write data to stream and files.
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
Field< label > labelField
Specialisation of Field<T> for label.
Definition labelField.H:48
const direction noexcept
Definition scalarImpl.H:265
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
runTime write()
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68