sampledIsoSurface.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-2021 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::isoSurface
26 
27 Description
28  A sampledSurface defined by a surface of iso value.
29 
30  Example:
31  \verbatim
32  {
33  type isoSurface;
34  isoField p;
35  isoValue 1e5;
36  filtering full;
37  interpolate yes;
38  }
39  \endverbatim
40 
41 Usage
42  \table
43  Property | Description | Required | Default value
44  isoField | the field to get an iso-surface of | yes |
45  isoValue | the iso-surface value | yes |
46  filtering | the level of filtering to perform on the iso-surface \\
47  | no | full
48  interpolate | interpolate values to the surface points | no | no
49  \endtable
50 
51 See also
52  Foam::isoSurface
53 
54 SourceFiles
55  sampledIsoSurface.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef sampledIsoSurface_H
60 #define sampledIsoSurface_H
61 
62 #include "sampledSurface.H"
63 #include "isoSurface.H"
64 #include "MeshedSurface.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 namespace sampledSurfaces
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class isoSurface Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 class isoSurface
78 :
79  public sampledSurface,
80  public MeshedSurface<face>
81 {
82  // Private Data
83 
84  //- Field to get isoSurface of
85  const word isoField_;
86 
87  //- Iso value
88  const scalarField isoVals_;
89 
90  //- Whether to coarsen
91  const Foam::isoSurface::filterType filter_;
92 
93 
94  // Recreated for every isoSurface
95 
96  //- Time at last call, also track it surface needs an update
97  mutable label prevTimeIndex_;
98 
99  //- For every triangle/face the original cell in mesh
100  mutable labelList meshCells_;
101 
102 
103  // Private Member Functions
104 
105  //- Create iso surface (if time has changed)
106  // Do nothing (and return false) if no update was needed
107  bool updateGeometry() const;
108 
109  //- Sample field on faces
110  template<class Type>
111  tmp<Field<Type>> sampleField
112  (
114  ) const;
115 
116  //- Interpolate field to vertices
117  template<class Type>
119  interpolateField(const interpolation<Type>&) const;
120 
121 
122 public:
123 
124  //- Runtime type information
125  TypeName("isoSurface");
126 
127 
128  // Constructors
129 
130  //- Construct from dictionary
131  isoSurface
132  (
133  const word& name,
134  const polyMesh& mesh,
135  const dictionary& dict
136  );
137 
138 
139  //- Destructor
140  virtual ~isoSurface();
141 
142 
143  // Member Functions
144 
145  //- Return the list of fields required
146  virtual wordList fields() const;
147 
148  //- Does the surface need an update?
149  virtual bool needsUpdate() const;
150 
151  //- Mark the surface as needing an update.
152  // May also free up unneeded data.
153  // Return false if surface was already marked as expired.
154  virtual bool expire();
155 
156  //- Update the surface as required.
157  // Do nothing (and return false) if no update was needed
158  virtual bool update();
159 
160  //- Points of surface
161  virtual const pointField& points() const
162  {
164  }
165 
166  //- Faces of surface
167  virtual const faceList& faces() const
168  {
169  return *this;
170  }
171 
172  //- Sample field on surface
173  virtual tmp<scalarField> sample
174  (
175  const volScalarField&
176  ) const;
177 
178  //- Sample field on surface
179  virtual tmp<vectorField> sample
180  (
181  const volVectorField&
182  ) const;
183 
184  //- Sample field on surface
186  (
188  ) const;
189 
190  //- Sample field on surface
192  (
193  const volSymmTensorField&
194  ) const;
195 
196  //- Sample field on surface
197  virtual tmp<tensorField> sample
198  (
199  const volTensorField&
200  ) const;
201 
202  //- Interpolate field on surface
204  (
205  const interpolation<scalar>&
206  ) const;
207 
208  //- Interpolate field on surface
210  (
211  const interpolation<vector>&
212  ) const;
213 
214  //- Interpolate field on surface
216  (
218  ) const;
219 
220  //- Interpolate field on surface
222  (
224  ) const;
225 
226  //- Interpolate field on surface
228  (
229  const interpolation<tensor>&
230  ) const;
231 
232  //- Write
233  virtual void print(Ostream&) const;
234 };
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 } // End namespace sampledSurfaces
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #ifdef NoRepository
246 #endif
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
dictionary dict
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual void print(Ostream &) const
Write.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
const word & name() const
Name of surface.
bool interpolate() const
Interpolation requested for surface.
Generic GeometricField class.
virtual bool needsUpdate() const
Does the surface need an update?
isoSurface(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
virtual bool expire()
Mark the surface as needing an update.
TypeName("isoSurface")
Runtime type information.
virtual const pointField & points() const
Points of surface.
A class for handling words, derived from string.
Definition: word.H:59
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const Field< PointType > & points() const
Return reference to global points.
const polyMesh & mesh() const
Access to the underlying mesh.
virtual wordList fields() const
Return the list of fields required.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Abstract base class for interpolation.
virtual const faceList & faces() const
Faces of surface.
virtual bool update()
Update the surface as required.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.