1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::sampledThresholdCellFaces
29 A sampledSurface defined by the cell faces corresponding to a threshold
33 sampledThresholdCellFaces.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef sampledThresholdCellFaces_H
38 #define sampledThresholdCellFaces_H
40 #include "sampledSurface.H"
41 #include "MeshedSurface.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class sampledThresholdCellFaces Declaration
50 \*---------------------------------------------------------------------------*/
52 class sampledThresholdCellFaces
54 public sampledSurface,
55 public MeshedSurface<face>
57 //- Private typedefs for convenience
58 typedef MeshedSurface<face> MeshStorage;
62 //- Field to get isoSurface of
63 const word fieldName_;
66 const scalar lowerThreshold_;
69 const scalar upperThreshold_;
71 //- zone name (if restricted to zones)
74 //- Triangulated faces or keep faces as is
77 // Recreated for every time-step
79 //- Time at last call, also track it surface needs an update
80 mutable label prevTimeIndex_;
82 //- For every face the original cell in mesh
83 mutable labelList meshCells_;
86 // Private Member Functions
88 //- Create surface (if time has changed)
89 // Do nothing (and return false) if no update was needed
90 bool updateGeometry() const;
92 //- sample field on faces
94 tmp<Field<Type> > sampleField
96 const GeometricField<Type, fvPatchField, volMesh>& vField
100 template <class Type>
102 interpolateField(const interpolation<Type>&) const;
107 //- Runtime type information
108 TypeName("sampledThresholdCellFaces");
113 //- Construct from dictionary
114 sampledThresholdCellFaces
124 virtual ~sampledThresholdCellFaces();
129 //- Does the surface need an update?
130 virtual bool needsUpdate() const;
132 //- Mark the surface as needing an update.
133 // May also free up unneeded data.
134 // Return false if surface was already marked as expired.
135 virtual bool expire();
137 //- Update the surface as required.
138 // Do nothing (and return false) if no update was needed
139 virtual bool update();
142 //- Points of surface
143 virtual const pointField& points() const
145 return MeshStorage::points();
149 virtual const faceList& faces() const
151 return MeshStorage::faces();
154 //- sample field on surface
155 virtual tmp<scalarField> sample
157 const volScalarField&
160 //- sample field on surface
161 virtual tmp<vectorField> sample
163 const volVectorField&
166 //- sample field on surface
167 virtual tmp<sphericalTensorField> sample
169 const volSphericalTensorField&
172 //- sample field on surface
173 virtual tmp<symmTensorField> sample
175 const volSymmTensorField&
178 //- sample field on surface
179 virtual tmp<tensorField> sample
181 const volTensorField&
185 //- interpolate field on surface
186 virtual tmp<scalarField> interpolate
188 const interpolation<scalar>&
191 //- interpolate field on surface
192 virtual tmp<vectorField> interpolate
194 const interpolation<vector>&
197 //- interpolate field on surface
198 virtual tmp<sphericalTensorField> interpolate
200 const interpolation<sphericalTensor>&
203 //- interpolate field on surface
204 virtual tmp<symmTensorField> interpolate
206 const interpolation<symmTensor>&
209 //- interpolate field on surface
210 virtual tmp<tensorField> interpolate
212 const interpolation<tensor>&
216 virtual void print(Ostream&) const;
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 } // End namespace Foam
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 # include "sampledThresholdCellFacesTemplates.C"
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 // ************************************************************************* //