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-2015 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
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>
94  (
96  ) const;
97 
98 
99  template<class Type>
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 // ************************************************************************* //
Foam::sampledThresholdCellFaces::lowerThreshold_
const scalar lowerThreshold_
Threshold value.
Definition: sampledThresholdCellFaces.H:64
Foam::sampledThresholdCellFaces::~sampledThresholdCellFaces
virtual ~sampledThresholdCellFaces()
Destructor.
Definition: sampledThresholdCellFaces.C:183
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::sampledThresholdCellFaces::prevTimeIndex_
label prevTimeIndex_
Time at last call, also track it surface needs an update.
Definition: sampledThresholdCellFaces.H:78
Foam::sampledThresholdCellFaces::fieldName_
const word fieldName_
Field to get isoSurface of.
Definition: sampledThresholdCellFaces.H:61
Foam::sampledThresholdCellFaces::sampledThresholdCellFaces
sampledThresholdCellFaces(const word &name, const polyMesh &, const dictionary &)
Construct from dictionary.
Definition: sampledThresholdCellFaces.C:149
Foam::sampledThresholdCellFaces::needsUpdate
virtual bool needsUpdate() const
Does the surface need an update?
Definition: sampledThresholdCellFaces.C:189
Foam::MeshedSurface< face >::faces
const List< Face > & faces() const
Return const access to the faces.
Definition: MeshedSurface.H:301
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::sampledThresholdCellFaces::update
virtual bool update()
Update the surface as required.
Definition: sampledThresholdCellFaces.C:211
Foam::sampledThresholdCellFaces::interpolateField
tmp< Field< Type > > interpolateField(const interpolation< Type > &) const
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:56
Foam::sampledThresholdCellFaces::expire
virtual bool expire()
Mark the surface as needing an update.
Definition: sampledThresholdCellFaces.C:197
Foam::label
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
Foam::sampledThresholdCellFaces::sample
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
Definition: sampledThresholdCellFaces.C:218
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::sampledThresholdCellFaces::meshCells_
labelList meshCells_
For every face the original cell in mesh.
Definition: sampledThresholdCellFaces.H:81
sampledSurface.H
Foam::sampledThresholdCellFaces::TypeName
TypeName("sampledThresholdCellFaces")
Runtime type information.
Foam::sampledSurface
An abstract class for surfaces with sampling.
Definition: sampledSurface.H:77
Foam::interpolation< Type >
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::sampledThresholdCellFaces::upperThreshold_
const scalar upperThreshold_
Threshold value.
Definition: sampledThresholdCellFaces.H:67
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::sampledThresholdCellFaces::zoneKey_
keyType zoneKey_
If restricted to zones, name of this zone or a regular expression.
Definition: sampledThresholdCellFaces.H:70
Foam::sampledThresholdCellFaces::MeshStorage
MeshedSurface< face > MeshStorage
Private typedefs for convenience.
Definition: sampledThresholdCellFaces.H:56
Foam::sampledThresholdCellFaces
A sampledSurface defined by the cell faces corresponding to a threshold value.
Definition: sampledThresholdCellFaces.H:50
Foam::sampledThresholdCellFaces::updateGeometry
bool updateGeometry() const
Create surface (if time has changed)
Definition: sampledThresholdCellFaces.C:51
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
sampledThresholdCellFacesTemplates.C
Foam::sampledSurface::name
const word & name() const
Name of surface.
Definition: sampledSurface.H:250
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::sampledThresholdCellFaces::faces
virtual const faceList & faces() const
Faces of surface.
Definition: sampledThresholdCellFaces.H:145
Foam::sampledThresholdCellFaces::triangulate_
bool triangulate_
Triangulated faces or keep faces as is.
Definition: sampledThresholdCellFaces.H:73
Foam::sampledThresholdCellFaces::sampleField
tmp< Field< Type > > sampleField(const GeometricField< Type, fvPatchField, volMesh > &vField) const
Sample field on faces.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::MeshedSurface
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Definition: MeshedSurface.H:72
Foam::sampledSurface::interpolate
bool interpolate() const
Interpolation requested for surface.
Definition: sampledSurface.H:256
Foam::sampledThresholdCellFaces::print
virtual void print(Ostream &) const
Write.
Definition: sampledThresholdCellFaces.C:307
Foam::sampledThresholdCellFaces::points
virtual const pointField & points() const
Points of surface.
Definition: sampledThresholdCellFaces.H:139
MeshedSurface.H