FreeFOAM The Cross-Platform CFD Toolkit
sampledPlane.H
Go to the documentation of this file.
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.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::sampledPlane
26 
27 Description
28  A sampledSurface defined by a cuttingPlane. Always triangulated.
29 
30  Note: does not cut at construction (since might need fields which
31  are not registered yet). Explicitly call update().
32 
33 SourceFiles
34  sampledPlane.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef sampledPlane_H
39 #define sampledPlane_H
40 
42 #include <sampling/cuttingPlane.H>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class sampledPlane Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public sampledSurface,
56  public cuttingPlane
57 {
58  // Private data
59 
60  //- zone name (if restricted to zones)
61  word zoneName_;
62 
63  //- Track if the surface needs an update
64  mutable bool needsUpdate_;
65 
66  // Private Member Functions
67 
68  //- sample field on faces
69  template <class Type>
70  tmp<Field<Type> > sampleField
71  (
73  ) const;
74 
75 
76  template <class Type>
78  interpolateField(const interpolation<Type>&) const;
79 
80 
81 public:
82 
83  //- Runtime type information
84  TypeName("sampledPlane");
85 
86 
87  // Constructors
88 
89  //- Construct from components
91  (
92  const word& name,
93  const polyMesh& mesh,
94  const plane& planeDesc,
95  const word& zoneName = word::null
96  );
97 
98  //- Construct from dictionary
100  (
101  const word& name,
102  const polyMesh& mesh,
103  const dictionary& dict
104  );
105 
106 
107  // Destructor
108 
109  virtual ~sampledPlane();
110 
111 
112  // Member Functions
113 
114  //- Does the surface need an update?
115  virtual bool needsUpdate() const;
116 
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();
121 
122  //- Update the surface as required.
123  // Do nothing (and return false) if no update was needed
124  virtual bool update();
125 
126 
127  //- Points of surface
128  virtual const pointField& points() const
129  {
130  return cuttingPlane::points();
131  }
132 
133  //- Faces of surface
134  virtual const faceList& faces() const
135  {
136  return cuttingPlane::faces();
137  }
138 
139  //- For every face original cell in mesh
140  const labelList& meshCells() const
141  {
142  return cuttingPlane::cutCells();
143  }
144 
145  //- sample field on surface
146  virtual tmp<scalarField> sample
147  (
148  const volScalarField&
149  ) const;
150 
151 
152  //- sample field on surface
153  virtual tmp<vectorField> sample
154  (
155  const volVectorField&
156  ) const;
157 
158  //- sample field on surface
160  (
162  ) const;
163 
164  //- sample field on surface
166  (
167  const volSymmTensorField&
168  ) const;
169 
170  //- sample field on surface
171  virtual tmp<tensorField> sample
172  (
173  const volTensorField&
174  ) const;
175 
176 
177  //- interpolate field on surface
179  (
180  const interpolation<scalar>&
181  ) const;
182 
183 
184  //- interpolate field on surface
186  (
187  const interpolation<vector>&
188  ) const;
189 
190  //- interpolate field on surface
192  (
194  ) const;
195 
196  //- interpolate field on surface
198  (
200  ) const;
201 
202  //- interpolate field on surface
204  (
205  const interpolation<tensor>&
206  ) const;
207 
208  //- Write
209  virtual void print(Ostream&) const;
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #ifdef NoRepository
220 # include "sampledPlaneTemplates.C"
221 #endif
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************ vim: set sw=4 sts=4 et: ************************ //