All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sampledPlane.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
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::sampledSurfaces::plane
26 
27 Description
28  A sampledSurface defined by a plane which 'cuts' the mesh using the
29  cuttingPlane alorithm. The plane is triangulated by default.
30 
31 Note
32  Does not actually cut until update() called.
33 
34 SourceFiles
35  sampledPlane.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef sampledPlane_H
40 #define sampledPlane_H
41 
42 #include "sampledSurface.H"
43 #include "cuttingPlane.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace sampledSurfaces
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class plane Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class plane
57 :
58  public sampledSurface,
59  public cuttingPlane
60 {
61  // Private Data
62 
63  //- If restricted to zones, name of this zone or a regular expression
64  keyType zoneKey_;
65 
66  //- Triangulated faces or keep faces as is
67  const bool triangulate_;
68 
69  //- Track if the surface needs an update
70  mutable bool needsUpdate_;
71 
72  // Private Member Functions
73 
74  //- Sample field on faces
75  template<class Type>
76  tmp<Field<Type>> sampleField
77  (
79  ) const;
80 
81 
82  template<class Type>
84  interpolateField(const interpolation<Type>&) const;
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("plane");
91 
92 
93  // Constructors
94 
95  //- Construct from components
96  plane
97  (
98  const word& name,
99  const polyMesh& mesh,
100  const plane& planeDesc,
101  const keyType& zoneKey = word::null,
102  const bool triangulate = true
103  );
104 
105  //- Construct from dictionary
106  plane
107  (
108  const word& name,
109  const polyMesh& mesh,
110  const dictionary& dict
111  );
112 
113 
114  //- Destructor
115  virtual ~plane();
116 
117 
118  // Member Functions
119 
120  //- Does the surface need an update?
121  virtual bool needsUpdate() const;
122 
123  //- Mark the surface as needing an update.
124  // May also free up unneeded data.
125  // Return false if surface was already marked as expired.
126  virtual bool expire();
127 
128  //- Update the surface as required.
129  // Do nothing (and return false) if no update was needed
130  virtual bool update();
131 
132 
133  //- Points of surface
134  virtual const pointField& points() const
135  {
136  return cuttingPlane::points();
137  }
138 
139  //- Faces of surface
140  virtual const faceList& faces() const
141  {
142  return cuttingPlane::faces();
143  }
144 
145  //- For every face original cell in mesh
146  const labelList& meshCells() const
147  {
148  return cuttingPlane::cutCells();
149  }
150 
151  //- Sample field on surface
152  virtual tmp<scalarField> sample
153  (
154  const volScalarField&
155  ) const;
156 
157 
158  //- Sample field on surface
159  virtual tmp<vectorField> sample
160  (
161  const volVectorField&
162  ) const;
163 
164  //- Sample field on surface
166  (
168  ) const;
169 
170  //- Sample field on surface
172  (
173  const volSymmTensorField&
174  ) const;
175 
176  //- Sample field on surface
177  virtual tmp<tensorField> sample
178  (
179  const volTensorField&
180  ) const;
181 
182 
183  //- Interpolate field on surface
185  (
186  const interpolation<scalar>&
187  ) const;
188 
189 
190  //- Interpolate field on surface
192  (
193  const interpolation<vector>&
194  ) const;
195 
196  //- Interpolate field on surface
198  (
200  ) const;
201 
202  //- Interpolate field on surface
204  (
206  ) const;
207 
208  //- Interpolate field on surface
210  (
211  const interpolation<tensor>&
212  ) const;
213 
214  //- Write
215  virtual void print(Ostream&) const;
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace sampledSurfaces
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #ifdef NoRepository
227  #include "sampledPlaneTemplates.C"
228 #endif
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
A sampledSurface defined by a plane which &#39;cuts&#39; the mesh using the cuttingPlane alorithm. The plane is triangulated by default.
Definition: sampledPlane.H:55
A class for handling keywords in dictionaries.
Definition: keyType.H:64
plane(const word &name, const polyMesh &mesh, const plane &planeDesc, const keyType &zoneKey=word::null, const bool triangulate=true)
Construct from components.
Definition: sampledPlane.C:44
dictionary dict
virtual const faceList & faces() const
Faces of surface.
virtual const faceList & faces() const
Faces of surface.
Definition: sampledPlane.H:139
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
An abstract class for surfaces with sampling.
TypeName("plane")
Runtime type information.
const word & name() const
Name of surface.
virtual bool needsUpdate() const
Does the surface need an update?
Definition: sampledPlane.C:110
bool interpolate() const
Interpolation requested for surface.
Generic GeometricField class.
virtual const pointField & points() const
Points of surface.
Definition: sampledPlane.H:133
virtual bool expire()
Mark the surface as needing an update.
Definition: sampledPlane.C:116
A sampledSurface defined by a plane using the iso-surface algorithm to &#39;cut&#39; the mesh.
virtual ~plane()
Destructor.
Definition: sampledPlane.C:104
A class for handling words, derived from string.
Definition: word.H:59
virtual const pointField & points() const
Points of surface.
static const word null
An empty word.
Definition: word.H:77
virtual bool update()
Update the surface as required.
Definition: sampledPlane.C:131
virtual void print(Ostream &) const
Write.
Definition: sampledPlane.C:251
const polyMesh & mesh() const
Access to the underlying mesh.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
Definition: sampledPlane.C:163
const labelList & meshCells() const
For every face original cell in mesh.
Definition: sampledPlane.H:145
Abstract base class for interpolation.
const labelList & cutCells() const
Return List of cells cut by the plane.
Definition: cuttingPlane.H:160
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.