All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2020 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  filter 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  filter | 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  //- Does the surface need an update?
146  virtual bool needsUpdate() const;
147 
148  //- Mark the surface as needing an update.
149  // May also free up unneeded data.
150  // Return false if surface was already marked as expired.
151  virtual bool expire();
152 
153  //- Update the surface as required.
154  // Do nothing (and return false) if no update was needed
155  virtual bool update();
156 
157  //- Points of surface
158  virtual const pointField& points() const
159  {
161  }
162 
163  //- Faces of surface
164  virtual const faceList& faces() const
165  {
166  return *this;
167  }
168 
169  //- Sample field on surface
170  virtual tmp<scalarField> sample
171  (
172  const volScalarField&
173  ) const;
174 
175  //- Sample field on surface
176  virtual tmp<vectorField> sample
177  (
178  const volVectorField&
179  ) const;
180 
181  //- Sample field on surface
183  (
185  ) const;
186 
187  //- Sample field on surface
189  (
190  const volSymmTensorField&
191  ) const;
192 
193  //- Sample field on surface
194  virtual tmp<tensorField> sample
195  (
196  const volTensorField&
197  ) const;
198 
199  //- Interpolate field on surface
201  (
202  const interpolation<scalar>&
203  ) const;
204 
205  //- Interpolate field on surface
207  (
208  const interpolation<vector>&
209  ) const;
210 
211  //- Interpolate field on surface
213  (
215  ) const;
216 
217  //- Interpolate field on surface
219  (
221  ) const;
222 
223  //- Interpolate field on surface
225  (
226  const interpolation<tensor>&
227  ) const;
228 
229  //- Write
230  virtual void print(Ostream&) const;
231 };
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 } // End namespace sampledSurfaces
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #ifdef NoRepository
243 #endif
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #endif
248 
249 // ************************************************************************* //
dictionary dict
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
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 tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
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.
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:74
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.