1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A sampledSurface on a patch. 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 word patchName_;
63 //- Triangulated faces or keep faces as is
66 //- Track if the surface needs an update
67 mutable bool needsUpdate_;
69 //- Local patch face labels
70 labelList patchFaceLabels_;
72 // Private Member Functions
75 //- sample field on faces
77 tmp<Field<Type> > sampleField
79 const GeometricField<Type, fvPatchField, volMesh>& vField
85 interpolateField(const interpolation<Type>&) const;
88 //- remap action on triangulation or cleanup
89 virtual void remapFaces(const UList<label>& faceMap);
93 //- Runtime type information
94 TypeName("sampledPatch");
99 //- Construct from components
103 const polyMesh& mesh,
104 const word& patchName,
105 const bool triangulate = false
108 //- Construct from dictionary
112 const polyMesh& mesh,
113 const dictionary& dict
119 virtual ~sampledPatch();
124 //- Does the surface need an update?
125 virtual bool needsUpdate() const;
127 //- Mark the surface as needing an update.
128 // May also free up unneeded data.
129 // Return false if surface was already marked as expired.
130 virtual bool expire();
132 //- Update the surface as required.
133 // Do nothing (and return false) if no update was needed
134 virtual bool update();
137 const word patchName() const
142 label patchIndex() const
144 return mesh().boundaryMesh().findPatchID(patchName_);
147 const labelList& patchFaceLabels() const
149 return patchFaceLabels_;
152 //- Points of surface
153 virtual const pointField& points() const
155 return MeshStorage::points();
159 virtual const faceList& faces() const
161 return MeshStorage::faces();
165 //- sample field on surface
166 virtual tmp<scalarField> sample
168 const volScalarField&
171 //- sample field on surface
172 virtual tmp<vectorField> sample
174 const volVectorField&
177 //- sample field on surface
178 virtual tmp<sphericalTensorField> sample
180 const volSphericalTensorField&
183 //- sample field on surface
184 virtual tmp<symmTensorField> sample
186 const volSymmTensorField&
189 //- sample field on surface
190 virtual tmp<tensorField> sample
192 const volTensorField&
196 //- interpolate field on surface
197 virtual tmp<scalarField> interpolate
199 const interpolation<scalar>&
203 //- interpolate field on surface
204 virtual tmp<vectorField> interpolate
206 const interpolation<vector>&
209 //- interpolate field on surface
210 virtual tmp<sphericalTensorField> interpolate
212 const interpolation<sphericalTensor>&
215 //- interpolate field on surface
216 virtual tmp<symmTensorField> interpolate
218 const interpolation<symmTensor>&
221 //- interpolate field on surface
222 virtual tmp<tensorField> interpolate
224 const interpolation<tensor>&
228 virtual void print(Ostream&) const;
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 } // End namespace Foam
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 # include "sampledPatchTemplates.C"
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 // ************************************************************************* //