sampledThresholdCellFaces.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::sampledThresholdCellFaces
29
30Description
31 A sampledSurface defined by the cell faces corresponding to a threshold
32 value.
33
34 This is often embedded as part of a sampled surfaces function object.
35
36Usage
37 Example of function object partial specification:
38 \verbatim
39 surfaces
40 {
41 surface1
42 {
43 type thresholdCellFaces;
44 field rho;
45 lowerLimit 0.1;
46 }
47 }
48 \endverbatim
49
50 Where the sub-entries comprise:
51 \table
52 Property | Description | Required | Default
53 type | thresholdCellFaces | yes |
54 field | field name for threshold | yes |
55 lowerLimit | lower limit for threshold | partly | -Inf
56 upperLimit | upper limit for threshold | partly | +Inf
57 triangulate | triangulate faces | no | false
58 \endtable
59
60Note
61 Must specify at least one or both of \c lowerLimit or \c upperLimit
62
63SeeAlso
64 Foam::thresholdCellFaces
65
66SourceFiles
67 sampledThresholdCellFaces.C
68
69\*---------------------------------------------------------------------------*/
70
71#ifndef sampledThresholdCellFaces_H
72#define sampledThresholdCellFaces_H
73
74#include "sampledSurface.H"
75#include "MeshedSurface.H"
76#include "MeshedSurfacesFwd.H"
77
78// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79
80namespace Foam
81{
82
83/*---------------------------------------------------------------------------*\
84 Class sampledThresholdCellFaces Declaration
85\*---------------------------------------------------------------------------*/
86
87class sampledThresholdCellFaces
88:
89 public sampledSurface,
90 public meshedSurface
91{
92 // Private typedef for convenience
93 typedef meshedSurface Mesh;
94
95
96 // Private Data
97
98 //- Threshold field
99 const word fieldName_;
100
101 //- Threshold value
102 const scalar lowerThreshold_;
103
104 //- Threshold value
105 const scalar upperThreshold_;
106
107 //- Triangulated faces or keep faces as is
108 bool triangulate_;
109
110 // Recreated for every time-step
111
112 //- Time at last call, also track it surface needs an update
113 mutable label prevTimeIndex_;
114
115 //- For every face the original cell in mesh
116 mutable labelList meshCells_;
117
118
119 // Private Member Functions
120
121 //- Create surface (if time has changed)
122 // Do nothing (and return false) if no update was needed
123 bool updateGeometry() const;
124
125 //- Sample volume field onto surface faces
126 template<class Type>
127 tmp<Field<Type>> sampleOnFaces
128 (
129 const interpolation<Type>& sampler
130 ) const;
131
132 //- Interpolate volume field onto surface points
133 template<class Type>
134 tmp<Field<Type>> sampleOnPoints
135 (
136 const interpolation<Type>& interpolator
137 ) const;
138
139
140public:
141
142 //- Runtime type information
143 TypeName("sampledThresholdCellFaces");
144
145
146 // Constructors
147
148 //- Construct from dictionary
150 (
151 const word& name,
152 const polyMesh&,
153 const dictionary&
154 );
155
156
157 //- Destructor
158 virtual ~sampledThresholdCellFaces() = default;
159
160
161 // Member Functions
162
163 //- Does the surface need an update?
164 virtual bool needsUpdate() const;
165
166 //- Mark the surface as needing an update.
167 // May also free up unneeded data.
168 // Return false if surface was already marked as expired.
169 virtual bool expire();
170
171 //- Update the surface as required.
172 // Do nothing (and return false) if no update was needed
173 virtual bool update();
174
175 //- Points of surface
176 virtual const pointField& points() const
177 {
178 return Mesh::points();
179 }
180
181 //- Faces of surface
182 virtual const faceList& faces() const
183 {
184 return Mesh::surfFaces();
185 }
186
187 //- Per-face zone/region information
188 virtual const labelList& zoneIds() const
189 {
190 return labelList::null();
191 }
192
193 //- Face area vectors (normals)
194 virtual const vectorField& Sf() const
195 {
196 return Mesh::Sf();
197 }
198
199 //- Face area magnitudes
200 virtual const scalarField& magSf() const
201 {
202 return Mesh::magSf();
203 }
204
205 //- Face centres
206 virtual const vectorField& Cf() const
207 {
208 return Mesh::Cf();
209 }
210
212 // Sample
213
214 //- Sample volume field onto surface faces
216 (
218 ) const;
219
220 //- Sample volume field onto surface faces
222 (
224 ) const;
225
226 //- Sample volume field onto surface faces
228 (
230 ) const;
231
232 //- Sample volume field onto surface faces
234 (
236 ) const;
237
238 //- Sample volume field onto surface faces
240 (
241 const interpolation<tensor>& sampler
242 ) const;
243
244
245 // Interpolate
246
247 //- Interpolate volume field onto surface points
249 (
250 const interpolation<scalar>& interpolator
251 ) const;
252
253 //- Interpolate volume field onto surface points
255 (
256 const interpolation<vector>& interpolator
257 ) const;
258
259 //- Interpolate volume field onto surface points
261 (
262 const interpolation<sphericalTensor>& interpolator
263 ) const;
264
265 //- Interpolate volume field onto surface points
267 (
268 const interpolation<symmTensor>& interpolator
269 ) const;
270
271 //- Interpolate volume field onto surface points
273 (
274 const interpolation<tensor>& interpolator
275 ) const;
276
277
278 // Output
279
280 //- Print information
281 virtual void print(Ostream& os, int level=0) const;
282};
283
284
285// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286
287} // End namespace Foam
288
289// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290
291#ifdef NoRepository
293#endif
294
295// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296
297#endif
298
299// ************************************************************************* //
Minimal example by using system/controlDict.functions:
static const List< label > & null()
Return a null List.
Definition: ListI.H:109
const vectorField & Sf() const
Face area vectors (normals)
const scalarField & magSf() const
Face area magnitudes.
const vectorField & Cf() const
Face centres.
const List< face > & surfFaces() const
Return const access to the faces.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Abstract base class for volume field interpolation.
Definition: interpolation.H:60
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
An abstract class for surfaces with sampling.
const word & name() const noexcept
Name of surface.
bool interpolate() const noexcept
Same as isPointData()
A sampledSurface defined by the cell faces corresponding to a threshold value.
virtual const pointField & points() const
Points of surface.
virtual void print(Ostream &os, int level=0) const
Print information.
virtual const faceList & faces() const
Faces of surface.
virtual const vectorField & Cf() const
Face centres.
virtual const labelList & zoneIds() const
Per-face zone/region information.
virtual const scalarField & magSf() const
Face area magnitudes.
virtual bool expire()
Mark the surface as needing an update.
virtual bool needsUpdate() const
Does the surface need an update?
virtual bool update()
Update the surface as required.
virtual const vectorField & Sf() const
Face area vectors (normals)
TypeName("sampledThresholdCellFaces")
Runtime type information.
virtual ~sampledThresholdCellFaces()=default
Destructor.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
const pointField & points
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
MeshedSurface< face > meshedSurface
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73