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::sampledIsoSurfaceCell
28 A sampledSurface defined by a surface of iso value. Always triangulated.
29 To be used in sampleSurfaces / functionObjects. Recalculates iso surface
33 sampledIsoSurfaceCell.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef sampledIsoSurfaceCell_H
38 #define sampledIsoSurfaceCell_H
40 #include "sampledSurface.H"
41 #include "triSurface.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class sampledIsoSurfaceCell Declaration
50 \*---------------------------------------------------------------------------*/
52 class sampledIsoSurfaceCell
54 public sampledSurface,
59 //- Field to get isoSurface of
66 const Switch regularise_;
68 //- Whether to recalculate cell values as average of point values
69 const Switch average_;
71 //- zone name (if restricted to zones)
74 //- triangles converted to faceList
75 mutable autoPtr<faceList> facesPtr_;
78 // Recreated for every isoSurface
80 //- Time at last call, also track it surface needs an update
81 mutable label prevTimeIndex_;
83 //- For every triangle the original cell in mesh
84 mutable labelList meshCells_;
87 // Private Member Functions
89 //- Create iso surface (if time has changed)
90 // Do nothing (and return false) if no update was needed
91 bool updateGeometry() const;
93 //- sample field on faces
95 tmp<Field<Type> > sampleField
97 const GeometricField<Type, fvPatchField, volMesh>& vField
101 template <class Type>
103 interpolateField(const interpolation<Type>&) const;
108 //- Runtime type information
109 TypeName("sampledIsoSurfaceCell");
114 //- Construct from dictionary
115 sampledIsoSurfaceCell
118 const polyMesh& mesh,
119 const dictionary& dict
125 virtual ~sampledIsoSurfaceCell();
130 //- Does the surface need an update?
131 virtual bool needsUpdate() const;
133 //- Mark the surface as needing an update.
134 // May also free up unneeded data.
135 // Return false if surface was already marked as expired.
136 virtual bool expire();
138 //- Update the surface as required.
139 // Do nothing (and return false) if no update was needed
140 virtual bool update();
143 //- Points of surface
144 virtual const pointField& points() const
146 return triSurface::points();
150 virtual const faceList& faces() const
152 if (facesPtr_.empty())
154 const triSurface& s = *this;
156 facesPtr_.reset(new faceList(s.size()));
160 facesPtr_()[i] = s[i].triFaceFace();
167 //- sample field on surface
168 virtual tmp<scalarField> sample
170 const volScalarField&
173 //- sample field on surface
174 virtual tmp<vectorField> sample
176 const volVectorField&
179 //- sample field on surface
180 virtual tmp<sphericalTensorField> sample
182 const volSphericalTensorField&
185 //- sample field on surface
186 virtual tmp<symmTensorField> sample
188 const volSymmTensorField&
191 //- sample field on surface
192 virtual tmp<tensorField> sample
194 const volTensorField&
198 //- interpolate field on surface
199 virtual tmp<scalarField> interpolate
201 const interpolation<scalar>&
204 //- interpolate field on surface
205 virtual tmp<vectorField> interpolate
207 const interpolation<vector>&
210 //- interpolate field on surface
211 virtual tmp<sphericalTensorField> interpolate
213 const interpolation<sphericalTensor>&
216 //- interpolate field on surface
217 virtual tmp<symmTensorField> interpolate
219 const interpolation<symmTensor>&
222 //- interpolate field on surface
223 virtual tmp<tensorField> interpolate
225 const interpolation<tensor>&
229 virtual void print(Ostream&) const;
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 } // End namespace Foam
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 # include "sampledIsoSurfaceCellTemplates.C"
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 // ************************************************************************* //