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::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"
42 #include "fvMeshSubset.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class sampledCuttingPlane Declaration
51 \*---------------------------------------------------------------------------*/
53 class sampledCuttingPlane
63 const scalar mergeTol_;
65 //- Whether to coarsen
66 const Switch regularise_;
68 //- zone name/index (if restricted to zones)
69 mutable cellZoneID zoneID_;
71 //- for zones: patch to put exposed faces into
72 mutable word exposedPatchName_;
74 //- Track if the surface needs an update
75 mutable bool needsUpdate_;
78 //- Optional subsetted mesh
79 autoPtr<fvMeshSubset> subMeshPtr_;
81 //- Distance to cell centres
82 autoPtr<volScalarField> cellDistancePtr_;
84 //- Distance to points
85 scalarField pointDistance_;
87 //- Constructed iso surface
88 autoPtr<isoSurface> isoSurfPtr_;
90 //- triangles converted to faceList
91 mutable autoPtr<faceList> facesPtr_;
94 // Private Member Functions
96 //- Create iso surface
97 void createGeometry();
99 //- sample field on faces
100 template <class Type>
101 tmp<Field<Type> > sampleField
103 const GeometricField<Type, fvPatchField, volMesh>& vField
107 template <class Type>
109 interpolateField(const interpolation<Type>&) const;
114 //- Runtime type information
115 TypeName("sampledCuttingPlane");
120 //- Construct from dictionary
124 const polyMesh& mesh,
125 const dictionary& dict
131 virtual ~sampledCuttingPlane();
136 //- Does the surface need an update?
137 virtual bool needsUpdate() const;
139 //- Mark the surface as needing an update.
140 // May also free up unneeded data.
141 // Return false if surface was already marked as expired.
142 virtual bool expire();
144 //- Update the surface as required.
145 // Do nothing (and return false) if no update was needed
146 virtual bool update();
148 //- Points of surface
149 virtual const pointField& points() const
151 return surface().points();
155 virtual const faceList& faces() const
157 if (facesPtr_.empty())
159 const triSurface& s = surface();
161 facesPtr_.reset(new faceList(s.size()));
165 facesPtr_()[i] = s[i].triFaceFace();
172 const isoSurface& surface() const
174 return isoSurfPtr_();
177 //- sample field on surface
178 virtual tmp<scalarField> sample
180 const volScalarField&
183 //- sample field on surface
184 virtual tmp<vectorField> sample
186 const volVectorField&
189 //- sample field on surface
190 virtual tmp<sphericalTensorField> sample
192 const volSphericalTensorField&
195 //- sample field on surface
196 virtual tmp<symmTensorField> sample
198 const volSymmTensorField&
201 //- sample field on surface
202 virtual tmp<tensorField> sample
204 const volTensorField&
208 //- interpolate field on surface
209 virtual tmp<scalarField> interpolate
211 const interpolation<scalar>&
214 //- interpolate field on surface
215 virtual tmp<vectorField> interpolate
217 const interpolation<vector>&
220 //- interpolate field on surface
221 virtual tmp<sphericalTensorField> interpolate
223 const interpolation<sphericalTensor>&
226 //- interpolate field on surface
227 virtual tmp<symmTensorField> interpolate
229 const interpolation<symmTensor>&
232 //- interpolate field on surface
233 virtual tmp<tensorField> interpolate
235 const interpolation<tensor>&
239 virtual void print(Ostream&) const;
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 } // End namespace Foam
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 # include "sampledCuttingPlaneTemplates.C"
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 // ************************************************************************* //