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::sampledIsoSurfaceCell
29 A sampledSurface defined by a surface of iso value. Always triangulated.
30 To be used in sampleSurfaces / functionObjects. Recalculates iso surface
34 sampledIsoSurfaceCell.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef sampledIsoSurfaceCell_H
39 #define sampledIsoSurfaceCell_H
41 #include "sampledSurface.H"
42 #include "triSurface.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class sampledIsoSurfaceCell Declaration
51 \*---------------------------------------------------------------------------*/
53 class sampledIsoSurfaceCell
55 public sampledSurface,
60 //- Field to get isoSurface of
67 const Switch regularise_;
69 //- Whether to recalculate cell values as average of point values
70 const Switch average_;
72 //- zone name (if restricted to zones)
75 //- triangles converted to faceList
76 mutable autoPtr<faceList> facesPtr_;
79 // Recreated for every isoSurface
81 //- Time at last call, also track it surface needs an update
82 mutable label prevTimeIndex_;
84 //- For every triangle the original cell in mesh
85 mutable labelList meshCells_;
88 // Private Member Functions
90 //- Create iso surface (if time has changed)
91 // Do nothing (and return false) if no update was needed
92 bool updateGeometry() const;
94 //- sample field on faces
96 tmp<Field<Type> > sampleField
98 const GeometricField<Type, fvPatchField, volMesh>& vField
102 template <class Type>
104 interpolateField(const interpolation<Type>&) const;
109 //- Runtime type information
110 TypeName("sampledIsoSurfaceCell");
115 //- Construct from dictionary
116 sampledIsoSurfaceCell
119 const polyMesh& mesh,
120 const dictionary& dict
126 virtual ~sampledIsoSurfaceCell();
131 //- Does the surface need an update?
132 virtual bool needsUpdate() const;
134 //- Mark the surface as needing an update.
135 // May also free up unneeded data.
136 // Return false if surface was already marked as expired.
137 virtual bool expire();
139 //- Update the surface as required.
140 // Do nothing (and return false) if no update was needed
141 virtual bool update();
144 //- Points of surface
145 virtual const pointField& points() const
147 return triSurface::points();
151 virtual const faceList& faces() const
153 if (facesPtr_.empty())
155 const triSurface& s = *this;
157 facesPtr_.reset(new faceList(s.size()));
161 facesPtr_()[i] = s[i].triFaceFace();
168 //- sample field on surface
169 virtual tmp<scalarField> sample
171 const volScalarField&
174 //- sample field on surface
175 virtual tmp<vectorField> sample
177 const volVectorField&
180 //- sample field on surface
181 virtual tmp<sphericalTensorField> sample
183 const volSphericalTensorField&
186 //- sample field on surface
187 virtual tmp<symmTensorField> sample
189 const volSymmTensorField&
192 //- sample field on surface
193 virtual tmp<tensorField> sample
195 const volTensorField&
199 //- interpolate field on surface
200 virtual tmp<scalarField> interpolate
202 const interpolation<scalar>&
205 //- interpolate field on surface
206 virtual tmp<vectorField> interpolate
208 const interpolation<vector>&
211 //- interpolate field on surface
212 virtual tmp<sphericalTensorField> interpolate
214 const interpolation<sphericalTensor>&
217 //- interpolate field on surface
218 virtual tmp<symmTensorField> interpolate
220 const interpolation<symmTensor>&
223 //- interpolate field on surface
224 virtual tmp<tensorField> interpolate
226 const interpolation<tensor>&
230 virtual void print(Ostream&) const;
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 } // End namespace Foam
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 # include "sampledIsoSurfaceCellTemplates.C"
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 // ************************************************************************* //