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::sampledCuttingPlane
28 A sampledSurface defined by a plane
33 \*---------------------------------------------------------------------------*/
35 #ifndef sampledCuttingPlane_H
36 #define sampledCuttingPlane_H
38 #include "sampledSurface.H"
39 #include "isoSurface.H"
40 //#include "isoSurfaceCell.H"
43 #include "fvMeshSubset.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class sampledCuttingPlane Declaration
52 \*---------------------------------------------------------------------------*/
54 class sampledCuttingPlane
64 const scalar mergeTol_;
66 //- Whether to coarsen
67 const Switch regularise_;
69 //- Whether to recalculate cell values as average of point values
70 const Switch average_;
72 //- zone name/index (if restricted to zones)
73 mutable cellZoneID zoneID_;
75 //- for zones: patch to put exposed faces into
76 mutable word exposedPatchName_;
78 //- Track if the surface needs an update
79 mutable bool needsUpdate_;
82 //- Optional subsetted mesh
83 autoPtr<fvMeshSubset> subMeshPtr_;
85 //- Distance to cell centres
86 autoPtr<volScalarField> cellDistancePtr_;
88 //- Distance to points
89 scalarField pointDistance_;
91 //- Constructed iso surface
92 //autoPtr<isoSurfaceCell> isoSurfPtr_;
93 autoPtr<isoSurface> isoSurfPtr_;
95 //- triangles converted to faceList
96 mutable autoPtr<faceList> facesPtr_;
99 // Private Member Functions
101 //- Create iso surface
102 void createGeometry();
104 //- sample field on faces
105 template <class Type>
106 tmp<Field<Type> > sampleField
108 const GeometricField<Type, fvPatchField, volMesh>& vField
112 template <class Type>
114 interpolateField(const interpolation<Type>&) const;
119 //- Runtime type information
120 TypeName("sampledCuttingPlane");
125 //- Construct from dictionary
129 const polyMesh& mesh,
130 const dictionary& dict
135 virtual ~sampledCuttingPlane();
140 //- Does the surface need an update?
141 virtual bool needsUpdate() const;
143 //- Mark the surface as needing an update.
144 // May also free up unneeded data.
145 // Return false if surface was already marked as expired.
146 virtual bool expire();
148 //- Update the surface as required.
149 // Do nothing (and return false) if no update was needed
150 virtual bool update();
152 //- Points of surface
153 virtual const pointField& points() const
155 return surface().points();
159 virtual const faceList& faces() const
161 if (facesPtr_.empty())
163 const triSurface& s = surface();
165 facesPtr_.reset(new faceList(s.size()));
169 facesPtr_()[i] = s[i].triFaceFace();
176 //const isoSurfaceCell& surface() const
177 const isoSurface& surface() const
179 return isoSurfPtr_();
182 //- sample field on surface
183 virtual tmp<scalarField> sample
185 const volScalarField&
188 //- sample field on surface
189 virtual tmp<vectorField> sample
191 const volVectorField&
194 //- sample field on surface
195 virtual tmp<sphericalTensorField> sample
197 const volSphericalTensorField&
200 //- sample field on surface
201 virtual tmp<symmTensorField> sample
203 const volSymmTensorField&
206 //- sample field on surface
207 virtual tmp<tensorField> sample
209 const volTensorField&
213 //- interpolate field on surface
214 virtual tmp<scalarField> interpolate
216 const interpolation<scalar>&
219 //- interpolate field on surface
220 virtual tmp<vectorField> interpolate
222 const interpolation<vector>&
225 //- interpolate field on surface
226 virtual tmp<sphericalTensorField> interpolate
228 const interpolation<sphericalTensor>&
231 //- interpolate field on surface
232 virtual tmp<symmTensorField> interpolate
234 const interpolation<symmTensor>&
237 //- interpolate field on surface
238 virtual tmp<tensorField> interpolate
240 const interpolation<tensor>&
244 virtual void print(Ostream&) const;
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 } // End namespace Foam
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 # include "sampledCuttingPlaneTemplates.C"
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 // ************************************************************************* //