sampledThresholdCellFaces.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::sampledSurfaces::thresholdCellFaces
26 
27 Description
28  A sampledSurface defined by the cell faces corresponding to a threshold
29  value.
30 
31 SourceFiles
32  sampledThresholdCellFaces.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef sampledThresholdCellFaces_H
37 #define sampledThresholdCellFaces_H
38 
39 #include "sampledSurface.H"
40 #include "MeshedSurface.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace sampledSurfaces
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class thresholdCellFaces Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public sampledSurface,
56  public MeshedSurface<face>
57 {
58  // Private Typedefs
59 
61 
62 
63  // Private Data
64 
65  //- Field to get isoSurface of
66  const word fieldName_;
67 
68  //- Threshold value
69  const scalar lowerThreshold_;
70 
71  //- Threshold value
72  const scalar upperThreshold_;
73 
74  //- If restricted to zones, name of this zone or a regular expression
75  keyType zoneKey_;
76 
77  //- Triangulated faces or keep faces as is
78  bool triangulate_;
79 
80  // Recreated for every time-step
81 
82  //- Time at last call, also track it surface needs an update
83  mutable label prevTimeIndex_;
84 
85  //- For every face the original cell in mesh
86  mutable labelList meshCells_;
87 
88 
89  // Private Member Functions
90 
91  //- Create surface (if time has changed)
92  // Do nothing (and return false) if no update was needed
93  bool updateGeometry() const;
94 
95  //- Sample field on faces
96  template<class Type>
97  tmp<Field<Type>> sampleField
98  (
100  ) const;
101 
102 
103  template<class Type>
105  interpolateField(const interpolation<Type>&) const;
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("thresholdCellFaces");
112 
113 
114  // Constructors
115 
116  //- Construct from dictionary
118  (
119  const word& name,
120  const polyMesh&,
121  const dictionary&
122  );
123 
124 
125  //- Destructor
126  virtual ~thresholdCellFaces();
127 
128 
129  // Member Functions
130 
131  //- Does the surface need an update?
132  virtual bool needsUpdate() const;
133 
134  //- Mark the surface as needing an update.
135  // May also free up unneeded data.
136  // Return false if surface was already marked as expired.
137  virtual bool expire();
138 
139  //- Update the surface as required.
140  // Do nothing (and return false) if no update was needed
141  virtual bool update();
142 
143  //- Points of surface
144  virtual const pointField& points() const
145  {
146  return MeshStorage::points();
147  }
148 
149  //- Faces of surface
150  virtual const faceList& faces() const
151  {
152  return MeshStorage::faces();
153  }
154 
155  //- Sample field on surface
156  virtual tmp<scalarField> sample(const volScalarField&) const;
157 
158  //- Sample field on surface
159  virtual tmp<vectorField> sample( const volVectorField&) const;
160 
161  //- Sample field on surface
163  (
165  ) const;
166 
167  //- Sample field on surface
168  virtual tmp<symmTensorField> sample(const volSymmTensorField&) const;
169 
170  //- Sample field on surface
171  virtual tmp<tensorField> sample
172  (
173  const volTensorField&
174  ) const;
175 
176  //- Interpolate field on surface
178  (
179  const interpolation<scalar>&
180  ) const;
181 
182  //- Interpolate field on surface
184  (
185  const interpolation<vector>&
186  ) const;
187 
188  //- Interpolate field on surface
190  (
192  ) const;
193 
194  //- Interpolate field on surface
196  (
198  ) const;
199 
200  //- Interpolate field on surface
202  (
203  const interpolation<tensor>&
204  ) const;
205 
206  //- Write
207  virtual void print(Ostream&) const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace sampledSurfaces
214 } // End namespace Foam
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #ifdef NoRepository
220 #endif
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
virtual bool update()
Update the surface as required.
A class for handling keywords in dictionaries.
Definition: keyType.H:64
thresholdCellFaces(const word &name, const polyMesh &, const dictionary &)
Construct from dictionary.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
An abstract class for surfaces with sampling.
const word & name() const
Name of surface.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: MeshedSurface.H:72
bool interpolate() const
Interpolation requested for surface.
Generic GeometricField class.
virtual bool needsUpdate() const
Does the surface need an update?
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
TypeName("thresholdCellFaces")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:59
const Field< PointType > & points() const
Return reference to global points.
A sampledSurface defined by the cell faces corresponding to a threshold value.
virtual const faceList & faces() const
Faces of surface.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual const pointField & points() const
Points of surface.
const List< face > & faces() const
Return const access to the faces.
virtual bool expire()
Mark the surface as needing an update.
Abstract base class for interpolation.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void print(Ostream &) const
Write.
Namespace for OpenFOAM.