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
29 A sampledSurface on a patch. Non-triangulated by default.
34 \*---------------------------------------------------------------------------*/
36 #ifndef sampledPatch_H
37 #define sampledPatch_H
39 #include "sampledSurface.H"
40 #include "MeshedSurface.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class sampledPatch Declaration
49 \*---------------------------------------------------------------------------*/
53 public MeshedSurface<face>,
56 //- Private typedefs for convenience
57 typedef MeshedSurface<face> MeshStorage;
62 const word patchName_;
64 //- Triangulated faces or keep faces as is
67 //- Track if the surface needs an update
68 mutable bool needsUpdate_;
70 //- Local patch face labels
71 labelList patchFaceLabels_;
73 // Private Member Functions
76 //- sample field on faces
78 tmp<Field<Type> > sampleField
80 const GeometricField<Type, fvPatchField, volMesh>& vField
86 interpolateField(const interpolation<Type>&) const;
89 //- remap action on triangulation or cleanup
90 virtual void remapFaces(const UList<label>& faceMap);
94 //- Runtime type information
95 TypeName("sampledPatch");
100 //- Construct from components
104 const polyMesh& mesh,
105 const word& patchName,
106 const bool triangulate = false
109 //- Construct from dictionary
113 const polyMesh& mesh,
114 const dictionary& dict
120 virtual ~sampledPatch();
125 //- Does the surface need an update?
126 virtual bool needsUpdate() const;
128 //- Mark the surface as needing an update.
129 // May also free up unneeded data.
130 // Return false if surface was already marked as expired.
131 virtual bool expire();
133 //- Update the surface as required.
134 // Do nothing (and return false) if no update was needed
135 virtual bool update();
138 const word patchName() const
143 label patchIndex() const
145 return mesh().boundaryMesh().findPatchID(patchName_);
148 const labelList& patchFaceLabels() const
150 return patchFaceLabels_;
153 //- Points of surface
154 virtual const pointField& points() const
156 return MeshStorage::points();
160 virtual const faceList& faces() const
162 return MeshStorage::faces();
166 //- sample field on surface
167 virtual tmp<scalarField> sample
169 const volScalarField&
172 //- sample field on surface
173 virtual tmp<vectorField> sample
175 const volVectorField&
178 //- sample field on surface
179 virtual tmp<sphericalTensorField> sample
181 const volSphericalTensorField&
184 //- sample field on surface
185 virtual tmp<symmTensorField> sample
187 const volSymmTensorField&
190 //- sample field on surface
191 virtual tmp<tensorField> sample
193 const volTensorField&
197 //- interpolate field on surface
198 virtual tmp<scalarField> interpolate
200 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 "sampledPatchTemplates.C"
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 // ************************************************************************* //