initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / sampling / sampledSurface / sampledPlane / sampledPlane.H
blob96576a834c97163dd0eeed6ed7768bf9fa528098
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 SourceFiles
32     sampledPlane.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef sampledPlane_H
37 #define sampledPlane_H
39 #include "sampledSurface.H"
40 #include "cuttingPlane.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                        Class sampledPlane Declaration
49 \*---------------------------------------------------------------------------*/
51 class sampledPlane
53     public sampledSurface,
54     public cuttingPlane
56     // Private data
58         //- zone name (if restricted to zones)
59         word zoneName_;
61         //- Track if the surface needs an update
62         mutable bool needsUpdate_;
64     // Private Member Functions
66         //- sample field on faces
67         template <class Type>
68         tmp<Field<Type> > sampleField
69         (
70             const GeometricField<Type, fvPatchField, volMesh>& vField
71         ) const;
74         template <class Type>
75         tmp<Field<Type> >
76         interpolateField(const interpolation<Type>&) const;
79 public:
81     //- Runtime type information
82     TypeName("sampledPlane");
85     // Constructors
87         //- Construct from components
88         sampledPlane
89         (
90             const word& name,
91             const polyMesh& mesh,
92             const plane& planeDesc,
93             const word& zoneName = word::null
94         );
96         //- Construct from dictionary
97         sampledPlane
98         (
99             const word& name,
100             const polyMesh& mesh,
101             const dictionary& dict
102         );
105     // Destructor
107         virtual ~sampledPlane();
110     // Member Functions
112         //- Does the surface need an update?
113         virtual bool needsUpdate() const;
115         //- Mark the surface as needing an update.
116         //  May also free up unneeded data.
117         //  Return false if surface was already marked as expired.
118         virtual bool expire();
120         //- Update the surface as required.
121         //  Do nothing (and return false) if no update was needed
122         virtual bool update();
125         //- Points of surface
126         virtual const pointField& points() const
127         {
128             return cuttingPlane::points();
129         }
131         //- Faces of surface
132         virtual const faceList& faces() const
133         {
134             return cuttingPlane::faces();
135         }
137         //- For every face original cell in mesh
138         const labelList& meshCells() const
139         {
140             return cuttingPlane::cutCells();
141         }
143         //- sample field on surface
144         virtual tmp<scalarField> sample
145         (
146             const volScalarField&
147         ) const;
150         //- sample field on surface
151         virtual tmp<vectorField> sample
152         (
153             const volVectorField&
154         ) const;
156         //- sample field on surface
157         virtual tmp<sphericalTensorField> sample
158         (
159             const volSphericalTensorField&
160         ) const;
162         //- sample field on surface
163         virtual tmp<symmTensorField> sample
164         (
165             const volSymmTensorField&
166         ) const;
168         //- sample field on surface
169         virtual tmp<tensorField> sample
170         (
171             const volTensorField&
172         ) const;
175         //- interpolate field on surface
176         virtual tmp<scalarField> interpolate
177         (
178             const interpolation<scalar>&
179         ) const;
182         //- interpolate field on surface
183         virtual tmp<vectorField> interpolate
184         (
185             const interpolation<vector>&
186         ) const;
188         //- interpolate field on surface
189         virtual tmp<sphericalTensorField> interpolate
190         (
191             const interpolation<sphericalTensor>&
192         ) const;
194         //- interpolate field on surface
195         virtual tmp<symmTensorField> interpolate
196         (
197             const interpolation<symmTensor>&
198         ) const;
200         //- interpolate field on surface
201         virtual tmp<tensorField> interpolate
202         (
203             const interpolation<tensor>&
204         ) const;
206         //- Write
207         virtual void print(Ostream&) const;
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 #ifdef NoRepository
218 #   include "sampledPlaneTemplates.C"
219 #endif
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 #endif
225 // ************************************************************************* //