ENH: patchCloudSet: new sampledSet
[OpenFOAM-1.7.x.git] / src / sampling / sampledSurface / sampledPlane / sampledPlane.H
blob84b21d63f0ffd103a2f7cbfb71838c4314eb74b4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2010 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
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
19     for more details.
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/>.
24 Class
25     Foam::sampledPlane
27 Description
28     A sampledSurface defined by a cuttingPlane. Always triangulated.
30     Note: does not cut at construction (since might need fields which
31     are not registered yet). Explicitly call update().
33 SourceFiles
34     sampledPlane.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef sampledPlane_H
39 #define sampledPlane_H
41 #include "sampledSurface.H"
42 #include "cuttingPlane.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 /*---------------------------------------------------------------------------*\
50                        Class sampledPlane Declaration
51 \*---------------------------------------------------------------------------*/
53 class sampledPlane
55     public sampledSurface,
56     public cuttingPlane
58     // Private data
60         //- zone name (if restricted to zones)
61         word zoneName_;
63         //- Track if the surface needs an update
64         mutable bool needsUpdate_;
66     // Private Member Functions
68         //- sample field on faces
69         template <class Type>
70         tmp<Field<Type> > sampleField
71         (
72             const GeometricField<Type, fvPatchField, volMesh>& vField
73         ) const;
76         template <class Type>
77         tmp<Field<Type> >
78         interpolateField(const interpolation<Type>&) const;
81 public:
83     //- Runtime type information
84     TypeName("sampledPlane");
87     // Constructors
89         //- Construct from components
90         sampledPlane
91         (
92             const word& name,
93             const polyMesh& mesh,
94             const plane& planeDesc,
95             const word& zoneName = word::null
96         );
98         //- Construct from dictionary
99         sampledPlane
100         (
101             const word& name,
102             const polyMesh& mesh,
103             const dictionary& dict
104         );
107     // Destructor
109         virtual ~sampledPlane();
112     // Member Functions
114         //- Does the surface need an update?
115         virtual bool needsUpdate() const;
117         //- Mark the surface as needing an update.
118         //  May also free up unneeded data.
119         //  Return false if surface was already marked as expired.
120         virtual bool expire();
122         //- Update the surface as required.
123         //  Do nothing (and return false) if no update was needed
124         virtual bool update();
127         //- Points of surface
128         virtual const pointField& points() const
129         {
130             return cuttingPlane::points();
131         }
133         //- Faces of surface
134         virtual const faceList& faces() const
135         {
136             return cuttingPlane::faces();
137         }
139         //- For every face original cell in mesh
140         const labelList& meshCells() const
141         {
142             return cuttingPlane::cutCells();
143         }
145         //- sample field on surface
146         virtual tmp<scalarField> sample
147         (
148             const volScalarField&
149         ) const;
152         //- sample field on surface
153         virtual tmp<vectorField> sample
154         (
155             const volVectorField&
156         ) const;
158         //- sample field on surface
159         virtual tmp<sphericalTensorField> sample
160         (
161             const volSphericalTensorField&
162         ) const;
164         //- sample field on surface
165         virtual tmp<symmTensorField> sample
166         (
167             const volSymmTensorField&
168         ) const;
170         //- sample field on surface
171         virtual tmp<tensorField> sample
172         (
173             const volTensorField&
174         ) const;
177         //- interpolate field on surface
178         virtual tmp<scalarField> interpolate
179         (
180             const interpolation<scalar>&
181         ) const;
184         //- interpolate field on surface
185         virtual tmp<vectorField> interpolate
186         (
187             const interpolation<vector>&
188         ) const;
190         //- interpolate field on surface
191         virtual tmp<sphericalTensorField> interpolate
192         (
193             const interpolation<sphericalTensor>&
194         ) const;
196         //- interpolate field on surface
197         virtual tmp<symmTensorField> interpolate
198         (
199             const interpolation<symmTensor>&
200         ) const;
202         //- interpolate field on surface
203         virtual tmp<tensorField> interpolate
204         (
205             const interpolation<tensor>&
206         ) const;
208         //- Write
209         virtual void print(Ostream&) const;
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 } // End namespace Foam
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 #ifdef NoRepository
220 #   include "sampledPlaneTemplates.C"
221 #endif
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 #endif
227 // ************************************************************************* //