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::sampledCuttingPlane
29 A sampledSurface defined by a plane
34 \*---------------------------------------------------------------------------*/
36 #ifndef sampledCuttingPlane_H
37 #define sampledCuttingPlane_H
39 #include "sampledSurface.H"
40 #include "isoSurface.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 //- zone name/index (if restricted to zones)
70 mutable cellZoneID zoneID_;
72 //- for zones: patch to put exposed faces into
73 mutable word exposedPatchName_;
75 //- Track if the surface needs an update
76 mutable bool needsUpdate_;
79 //- Optional subsetted mesh
80 autoPtr<fvMeshSubset> subMeshPtr_;
82 //- Distance to cell centres
83 autoPtr<volScalarField> cellDistancePtr_;
85 //- Distance to points
86 scalarField pointDistance_;
88 //- Constructed iso surface
89 autoPtr<isoSurface> isoSurfPtr_;
91 //- triangles converted to faceList
92 mutable autoPtr<faceList> facesPtr_;
95 // Private Member Functions
97 //- Create iso surface
98 void createGeometry();
100 //- sample field on faces
101 template <class Type>
102 tmp<Field<Type> > sampleField
104 const GeometricField<Type, fvPatchField, volMesh>& vField
108 template <class Type>
110 interpolateField(const interpolation<Type>&) const;
115 //- Runtime type information
116 TypeName("sampledCuttingPlane");
121 //- Construct from dictionary
125 const polyMesh& mesh,
126 const dictionary& dict
132 virtual ~sampledCuttingPlane();
137 //- Does the surface need an update?
138 virtual bool needsUpdate() const;
140 //- Mark the surface as needing an update.
141 // May also free up unneeded data.
142 // Return false if surface was already marked as expired.
143 virtual bool expire();
145 //- Update the surface as required.
146 // Do nothing (and return false) if no update was needed
147 virtual bool update();
149 //- Points of surface
150 virtual const pointField& points() const
152 return surface().points();
156 virtual const faceList& faces() const
158 if (facesPtr_.empty())
160 const triSurface& s = surface();
162 facesPtr_.reset(new faceList(s.size()));
166 facesPtr_()[i] = s[i].triFaceFace();
173 const isoSurface& surface() const
175 return isoSurfPtr_();
178 //- sample field on surface
179 virtual tmp<scalarField> sample
181 const volScalarField&
184 //- sample field on surface
185 virtual tmp<vectorField> sample
187 const volVectorField&
190 //- sample field on surface
191 virtual tmp<sphericalTensorField> sample
193 const volSphericalTensorField&
196 //- sample field on surface
197 virtual tmp<symmTensorField> sample
199 const volSymmTensorField&
202 //- sample field on surface
203 virtual tmp<tensorField> sample
205 const volTensorField&
209 //- interpolate field on surface
210 virtual tmp<scalarField> interpolate
212 const interpolation<scalar>&
215 //- interpolate field on surface
216 virtual tmp<vectorField> interpolate
218 const interpolation<vector>&
221 //- interpolate field on surface
222 virtual tmp<sphericalTensorField> interpolate
224 const interpolation<sphericalTensor>&
227 //- interpolate field on surface
228 virtual tmp<symmTensorField> interpolate
230 const interpolation<symmTensor>&
233 //- interpolate field on surface
234 virtual tmp<tensorField> interpolate
236 const interpolation<tensor>&
240 virtual void print(Ostream&) const;
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 } // End namespace Foam
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 # include "sampledCuttingPlaneTemplates.C"
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 // ************************************************************************* //