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/>.
28 A sampledSurface on patches. Non-triangulated by default.
33 \*---------------------------------------------------------------------------*/
35 #ifndef sampledPatch_H
36 #define sampledPatch_H
38 #include "sampledSurface.H"
39 #include "MeshedSurface.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 /*---------------------------------------------------------------------------*\
47 Class sampledPatch Declaration
48 \*---------------------------------------------------------------------------*/
52 public MeshedSurface<face>,
55 //- Private typedefs for convenience
56 typedef MeshedSurface<face> MeshStorage;
61 const wordReList patchNames_;
63 //- Corresponding patchIDs
64 mutable labelList patchIDs_;
66 //- Triangulated faces or keep faces as is
69 //- Track if the surface needs an update
70 mutable bool needsUpdate_;
72 //- For every face (or triangle) the originating patch
73 labelList patchIndex_;
75 //- For every face (or triangle) the index in the originating patch
76 labelList patchFaceLabels_;
78 //- Start indices (in patchFaceLabels_) of patches
79 labelList patchStart_;
81 // Private Member Functions
83 //- sample field on faces
85 tmp<Field<Type> > sampleField
87 const GeometricField<Type, fvPatchField, volMesh>& vField
92 interpolateField(const interpolation<Type>&) const;
94 //- remap action on triangulation or cleanup
95 virtual void remapFaces(const labelUList& faceMap);
100 const wordReList& patchNames() const
105 const labelList& patchIDs() const;
107 const labelList& patchStart() const
112 const labelList& patchFaceLabels() const
114 return patchFaceLabels_;
120 //- Runtime type information
121 TypeName("sampledPatch");
126 //- Construct from components
130 const polyMesh& mesh,
131 const wordReList& patchNames,
132 const bool triangulate = false
135 //- Construct from dictionary
139 const polyMesh& mesh,
140 const dictionary& dict
145 virtual ~sampledPatch();
150 //- Does the surface need an update?
151 virtual bool needsUpdate() const;
153 //- Mark the surface as needing an update.
154 // May also free up unneeded data.
155 // Return false if surface was already marked as expired.
156 virtual bool expire();
158 //- Update the surface as required.
159 // Do nothing (and return false) if no update was needed
160 virtual bool update();
163 //- Points of surface
164 virtual const pointField& points() const
166 return MeshStorage::points();
170 virtual const faceList& faces() const
172 return MeshStorage::faces();
176 //- sample field on surface
177 virtual tmp<scalarField> sample
179 const volScalarField&
182 //- sample field on surface
183 virtual tmp<vectorField> sample
185 const volVectorField&
188 //- sample field on surface
189 virtual tmp<sphericalTensorField> sample
191 const volSphericalTensorField&
194 //- sample field on surface
195 virtual tmp<symmTensorField> sample
197 const volSymmTensorField&
200 //- sample field on surface
201 virtual tmp<tensorField> sample
203 const volTensorField&
207 //- interpolate field on surface
208 virtual tmp<scalarField> interpolate
210 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 "sampledPatchTemplates.C"
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 // ************************************************************************* //