FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 
40 #include <surfMesh/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  //- zone name (if restricted to zones)
71  word zoneName_;
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 
123  virtual ~sampledThresholdCellFaces();
124 
125 
126  // Member Functions
127 
128  //- Does the surface need an update?
129  virtual bool needsUpdate() const;
130 
131  //- Mark the surface as needing an update.
132  // May also free up unneeded data.
133  // Return false if surface was already marked as expired.
134  virtual bool expire();
135 
136  //- Update the surface as required.
137  // Do nothing (and return false) if no update was needed
138  virtual bool update();
139 
140 
141  //- Points of surface
142  virtual const pointField& points() const
143  {
144  return MeshStorage::points();
145  }
146 
147  //- Faces of surface
148  virtual const faceList& faces() const
149  {
150  return MeshStorage::faces();
151  }
152 
153  //- sample field on surface
154  virtual tmp<scalarField> sample
155  (
156  const volScalarField&
157  ) const;
158 
159  //- sample field on surface
160  virtual tmp<vectorField> sample
161  (
162  const volVectorField&
163  ) const;
164 
165  //- sample field on surface
167  (
169  ) const;
170 
171  //- sample field on surface
173  (
174  const volSymmTensorField&
175  ) const;
176 
177  //- sample field on surface
178  virtual tmp<tensorField> sample
179  (
180  const volTensorField&
181  ) const;
182 
183 
184  //- interpolate field on surface
186  (
187  const interpolation<scalar>&
188  ) const;
189 
190  //- interpolate field on surface
192  (
193  const interpolation<vector>&
194  ) const;
195 
196  //- interpolate field on surface
198  (
200  ) const;
201 
202  //- interpolate field on surface
204  (
206  ) const;
207 
208  //- interpolate field on surface
210  (
211  const interpolation<tensor>&
212  ) const;
213 
214  //- Write
215  virtual void print(Ostream&) const;
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #ifdef NoRepository
227 #endif
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************ vim: set sw=4 sts=4 et: ************************ //