STYLE: sampledPlane : added comment about calling update() after construction
[OpenFOAM-1.6.x.git] / src / sampling / sampledSurface / sampledPlane / sampledPlane.H
blob47dcc236527cf170cd54f93c3476df014eca86e7
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::sampledPlane
28 Description
29     A sampledSurface defined by a cuttingPlane. Always triangulated.
31     Note: does not cut at construction (since might need fields which
32     are not registered yet). Explicitly call update().
34 SourceFiles
35     sampledPlane.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef sampledPlane_H
40 #define sampledPlane_H
42 #include "sampledSurface.H"
43 #include "cuttingPlane.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                        Class sampledPlane Declaration
52 \*---------------------------------------------------------------------------*/
54 class sampledPlane
56     public sampledSurface,
57     public cuttingPlane
59     // Private data
61         //- zone name (if restricted to zones)
62         word zoneName_;
64         //- Track if the surface needs an update
65         mutable bool needsUpdate_;
67     // Private Member Functions
69         //- sample field on faces
70         template <class Type>
71         tmp<Field<Type> > sampleField
72         (
73             const GeometricField<Type, fvPatchField, volMesh>& vField
74         ) const;
77         template <class Type>
78         tmp<Field<Type> >
79         interpolateField(const interpolation<Type>&) const;
82 public:
84     //- Runtime type information
85     TypeName("sampledPlane");
88     // Constructors
90         //- Construct from components
91         sampledPlane
92         (
93             const word& name,
94             const polyMesh& mesh,
95             const plane& planeDesc,
96             const word& zoneName = word::null
97         );
99         //- Construct from dictionary
100         sampledPlane
101         (
102             const word& name,
103             const polyMesh& mesh,
104             const dictionary& dict
105         );
108     // Destructor
110         virtual ~sampledPlane();
113     // Member Functions
115         //- Does the surface need an update?
116         virtual bool needsUpdate() const;
118         //- Mark the surface as needing an update.
119         //  May also free up unneeded data.
120         //  Return false if surface was already marked as expired.
121         virtual bool expire();
123         //- Update the surface as required.
124         //  Do nothing (and return false) if no update was needed
125         virtual bool update();
128         //- Points of surface
129         virtual const pointField& points() const
130         {
131             return cuttingPlane::points();
132         }
134         //- Faces of surface
135         virtual const faceList& faces() const
136         {
137             return cuttingPlane::faces();
138         }
140         //- For every face original cell in mesh
141         const labelList& meshCells() const
142         {
143             return cuttingPlane::cutCells();
144         }
146         //- sample field on surface
147         virtual tmp<scalarField> sample
148         (
149             const volScalarField&
150         ) const;
153         //- sample field on surface
154         virtual tmp<vectorField> sample
155         (
156             const volVectorField&
157         ) const;
159         //- sample field on surface
160         virtual tmp<sphericalTensorField> sample
161         (
162             const volSphericalTensorField&
163         ) const;
165         //- sample field on surface
166         virtual tmp<symmTensorField> sample
167         (
168             const volSymmTensorField&
169         ) const;
171         //- sample field on surface
172         virtual tmp<tensorField> sample
173         (
174             const volTensorField&
175         ) const;
178         //- interpolate field on surface
179         virtual tmp<scalarField> interpolate
180         (
181             const interpolation<scalar>&
182         ) const;
185         //- interpolate field on surface
186         virtual tmp<vectorField> interpolate
187         (
188             const interpolation<vector>&
189         ) const;
191         //- interpolate field on surface
192         virtual tmp<sphericalTensorField> interpolate
193         (
194             const interpolation<sphericalTensor>&
195         ) const;
197         //- interpolate field on surface
198         virtual tmp<symmTensorField> interpolate
199         (
200             const interpolation<symmTensor>&
201         ) const;
203         //- interpolate field on surface
204         virtual tmp<tensorField> interpolate
205         (
206             const interpolation<tensor>&
207         ) const;
209         //- Write
210         virtual void print(Ostream&) const;
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 } // End namespace Foam
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 #ifdef NoRepository
221 #   include "sampledPlaneTemplates.C"
222 #endif
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 #endif
228 // ************************************************************************* //