1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 //- If restricted to zones, name of this zone or a regular expression
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
122 virtual ~sampledThresholdCellFaces();
127 //- Does the surface need an update?
128 virtual bool needsUpdate() const;
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();
135 //- Update the surface as required.
136 // Do nothing (and return false) if no update was needed
137 virtual bool update();
139 //- Points of surface
140 virtual const pointField& points() const
142 return MeshStorage::points();
146 virtual const faceList& faces() const
148 return MeshStorage::faces();
151 //- sample field on surface
152 virtual tmp<scalarField> sample(const volScalarField&) const;
154 //- sample field on surface
155 virtual tmp<vectorField> sample( const volVectorField&) const;
157 //- sample field on surface
158 virtual tmp<sphericalTensorField> sample
160 const volSphericalTensorField&
163 //- sample field on surface
164 virtual tmp<symmTensorField> sample(const volSymmTensorField&) const;
166 //- sample field on surface
167 virtual tmp<tensorField> sample
169 const volTensorField&
172 //- interpolate field on surface
173 virtual tmp<scalarField> interpolate
175 const interpolation<scalar>&
178 //- interpolate field on surface
179 virtual tmp<vectorField> interpolate
181 const interpolation<vector>&
184 //- interpolate field on surface
185 virtual tmp<sphericalTensorField> interpolate
187 const interpolation<sphericalTensor>&
190 //- interpolate field on surface
191 virtual tmp<symmTensorField> interpolate
193 const interpolation<symmTensor>&
196 //- interpolate field on surface
197 virtual tmp<tensorField> interpolate
199 const interpolation<tensor>&
203 virtual void print(Ostream&) const;
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 } // End namespace Foam
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 # include "sampledThresholdCellFacesTemplates.C"
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 // ************************************************************************* //