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 | Copyright (C) 2011-2016 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::sampledThresholdCellFaces
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 
47 /*---------------------------------------------------------------------------*\
48  Class sampledThresholdCellFaces Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public sampledSurface,
54  public MeshedSurface<face>
55 {
56  //- Private typedefs for convenience
58 
59  // Private data
60 
61  //- Field to get isoSurface of
62  const word fieldName_;
63 
64  //- Threshold value
65  const scalar lowerThreshold_;
66 
67  //- Threshold value
68  const scalar upperThreshold_;
69 
70  //- If restricted to zones, name of this zone or a regular expression
71  keyType zoneKey_;
72 
73  //- Triangulated faces or keep faces as is
74  bool triangulate_;
75 
76  // Recreated for every time-step
77 
78  //- Time at last call, also track it surface needs an update
79  mutable label prevTimeIndex_;
80 
81  //- For every face the original cell in mesh
82  mutable labelList meshCells_;
83 
84 
85  // Private Member Functions
86 
87  //- Create surface (if time has changed)
88  // Do nothing (and return false) if no update was needed
89  bool updateGeometry() const;
90 
91  //- Sample field on faces
92  template<class Type>
93  tmp<Field<Type>> sampleField
94  (
96  ) const;
97 
98 
99  template<class Type>
101  interpolateField(const interpolation<Type>&) const;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeName("sampledThresholdCellFaces");
108 
109 
110  // Constructors
111 
112  //- Construct from dictionary
114  (
115  const word& name,
116  const polyMesh&,
117  const dictionary&
118  );
119 
120 
121  //- Destructor
122  virtual ~sampledThresholdCellFaces();
123 
124 
125  // Member Functions
126 
127  //- Does the surface need an update?
128  virtual bool needsUpdate() const;
129 
130  //- Mark the surface as needing an update.
131  // May also free up unneeded data.
132  // Return false if surface was already marked as expired.
133  virtual bool expire();
134 
135  //- Update the surface as required.
136  // Do nothing (and return false) if no update was needed
137  virtual bool update();
138 
139  //- Points of surface
140  virtual const pointField& points() const
141  {
142  return MeshStorage::points();
143  }
144 
145  //- Faces of surface
146  virtual const faceList& faces() const
147  {
148  return MeshStorage::faces();
149  }
150 
151  //- Sample field on surface
152  virtual tmp<scalarField> sample(const volScalarField&) const;
153 
154  //- Sample field on surface
155  virtual tmp<vectorField> sample( const volVectorField&) const;
156 
157  //- Sample field on surface
159  (
161  ) const;
162 
163  //- Sample field on surface
164  virtual tmp<symmTensorField> sample(const volSymmTensorField&) const;
165 
166  //- Sample field on surface
167  virtual tmp<tensorField> sample
168  (
169  const volTensorField&
170  ) const;
171 
172  //- Interpolate field on surface
174  (
175  const interpolation<scalar>&
176  ) const;
177 
178  //- Interpolate field on surface
180  (
181  const interpolation<vector>&
182  ) const;
183 
184  //- Interpolate field on surface
186  (
188  ) const;
189 
190  //- Interpolate field on surface
192  (
194  ) const;
195 
196  //- Interpolate field on surface
198  (
199  const interpolation<tensor>&
200  ) const;
201 
202  //- Write
203  virtual void print(Ostream&) const;
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #ifdef NoRepository
215 #endif
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
virtual ~sampledThresholdCellFaces()
Destructor.
virtual bool update()
Update the surface as required.
A class for handling keywords in dictionaries.
Definition: keyType.H:64
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 const pointField & points() const
Points of surface.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An abstract class for surfaces with sampling.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: MeshedSurface.H:72
virtual bool needsUpdate() const
Does the surface need an update?
virtual void print(Ostream &) const
Write.
virtual const faceList & faces() const
Faces of surface.
const List< face > & faces() const
Return const access to the faces.
const Field< PointType > & points() const
Return reference to global points.
Generic GeometricField class.
sampledThresholdCellFaces(const word &name, const polyMesh &, const dictionary &)
Construct from dictionary.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool expire()
Mark the surface as needing an update.
const word & name() const
Name of surface.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
bool interpolate() const
Interpolation requested for surface.
TypeName("sampledThresholdCellFaces")
Runtime type information.
Abstract base class for interpolation.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:54
A sampledSurface defined by the cell faces corresponding to a threshold value.
Namespace for OpenFOAM.