1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
25 Foam::sampledThresholdCellFaces
28 A sampledSurface defined by the cell faces corresponding to a threshold
32 sampledThresholdCellFaces.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef sampledThresholdCellFaces_H
37 #define sampledThresholdCellFaces_H
39 #include "sampledSurface.H"
40 #include "MeshedSurface.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class sampledThresholdCellFaces Declaration
49 \*---------------------------------------------------------------------------*/
51 class sampledThresholdCellFaces
53 public sampledSurface,
54 public MeshedSurface<face>
56 //- Private typedefs for convenience
57 typedef MeshedSurface<face> MeshStorage;
61 //- Field to get isoSurface of
62 const word fieldName_;
65 const scalar lowerThreshold_;
68 const scalar upperThreshold_;
70 //- zone name (if restricted to zones)
73 //- Triangulated faces or keep faces as is
76 // Recreated for every time-step
78 //- Time at last call, also track it surface needs an update
79 mutable label prevTimeIndex_;
81 //- For every face the original cell in mesh
82 mutable labelList meshCells_;
85 // Private Member Functions
87 //- Create surface (if time has changed)
88 // Do nothing (and return false) if no update was needed
89 bool updateGeometry() const;
91 //- sample field on faces
93 tmp<Field<Type> > sampleField
95 const GeometricField<Type, fvPatchField, volMesh>& vField
101 interpolateField(const interpolation<Type>&) const;
106 //- Runtime type information
107 TypeName("sampledThresholdCellFaces");
112 //- Construct from dictionary
113 sampledThresholdCellFaces
123 virtual ~sampledThresholdCellFaces();
128 //- Does the surface need an update?
129 virtual bool needsUpdate() const;
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();
136 //- Update the surface as required.
137 // Do nothing (and return false) if no update was needed
138 virtual bool update();
141 //- Points of surface
142 virtual const pointField& points() const
144 return MeshStorage::points();
148 virtual const faceList& faces() const
150 return MeshStorage::faces();
153 //- sample field on surface
154 virtual tmp<scalarField> sample
156 const volScalarField&
159 //- sample field on surface
160 virtual tmp<vectorField> sample
162 const volVectorField&
165 //- sample field on surface
166 virtual tmp<sphericalTensorField> sample
168 const volSphericalTensorField&
171 //- sample field on surface
172 virtual tmp<symmTensorField> sample
174 const volSymmTensorField&
177 //- sample field on surface
178 virtual tmp<tensorField> sample
180 const volTensorField&
184 //- interpolate field on surface
185 virtual tmp<scalarField> interpolate
187 const interpolation<scalar>&
190 //- interpolate field on surface
191 virtual tmp<vectorField> interpolate
193 const interpolation<vector>&
196 //- interpolate field on surface
197 virtual tmp<sphericalTensorField> interpolate
199 const interpolation<sphericalTensor>&
202 //- interpolate field on surface
203 virtual tmp<symmTensorField> interpolate
205 const interpolation<symmTensor>&
208 //- interpolate field on surface
209 virtual tmp<tensorField> interpolate
211 const interpolation<tensor>&
215 virtual void print(Ostream&) const;
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 } // End namespace Foam
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 # include "sampledThresholdCellFacesTemplates.C"
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 // ************************************************************************* //