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-2020 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 algorithm. 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 dictionary
96  plane
97  (
98  const word& name,
99  const polyMesh& mesh,
100  const dictionary& dict
101  );
102 
103 
104  //- Destructor
105  virtual ~plane();
106 
107 
108  // Member Functions
109 
110  //- Does the surface need an update?
111  virtual bool needsUpdate() const;
112 
113  //- Mark the surface as needing an update.
114  // May also free up unneeded data.
115  // Return false if surface was already marked as expired.
116  virtual bool expire();
117 
118  //- Update the surface as required.
119  // Do nothing (and return false) if no update was needed
120  virtual bool update();
121 
122 
123  //- Points of surface
124  virtual const pointField& points() const
125  {
126  return cuttingPlane::points();
127  }
128 
129  //- Faces of surface
130  virtual const faceList& faces() const
131  {
132  return cuttingPlane::faces();
133  }
134 
135  //- For every face original cell in mesh
136  const labelList& meshCells() const
137  {
138  return cuttingPlane::cutCells();
139  }
140 
141  //- Sample field on surface
142  virtual tmp<scalarField> sample
143  (
144  const volScalarField&
145  ) const;
146 
147 
148  //- Sample field on surface
149  virtual tmp<vectorField> sample
150  (
151  const volVectorField&
152  ) const;
153 
154  //- Sample field on surface
156  (
158  ) const;
159 
160  //- Sample field on surface
162  (
163  const volSymmTensorField&
164  ) const;
165 
166  //- Sample field on surface
167  virtual tmp<tensorField> sample
168  (
169  const volTensorField&
170  ) const;
171 
172 
173  //- Interpolate field on surface
175  (
176  const interpolation<scalar>&
177  ) const;
178 
179 
180  //- Interpolate field on surface
182  (
183  const interpolation<vector>&
184  ) const;
185 
186  //- Interpolate field on surface
188  (
190  ) const;
191 
192  //- Interpolate field on surface
194  (
196  ) const;
197 
198  //- Interpolate field on surface
200  (
201  const interpolation<tensor>&
202  ) const;
203 
204  //- Write
205  virtual void print(Ostream&) const;
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace sampledSurfaces
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #ifdef NoRepository
217  #include "sampledPlaneTemplates.C"
218 #endif
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
A sampledSurface defined by a plane which &#39;cuts&#39; the mesh using the cuttingPlane algorithm. The plane is triangulated by default.
Definition: sampledPlane.H:55
A class for handling keywords in dictionaries.
Definition: keyType.H:66
dictionary dict
virtual const faceList & faces() const
Faces of surface.
virtual const faceList & faces() const
Faces of surface.
Definition: sampledPlane.H:129
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:87
bool interpolate() const
Interpolation requested for surface.
Generic GeometricField class.
virtual const pointField & points() const
Points of surface.
Definition: sampledPlane.H:123
virtual bool expire()
Mark the surface as needing an update.
Definition: sampledPlane.C:93
A sampledSurface defined by a plane using the iso-surface algorithm to &#39;cut&#39; the mesh.
virtual ~plane()
Destructor.
Definition: sampledPlane.C:81
plane(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: sampledPlane.C:44
A class for handling words, derived from string.
Definition: word.H:59
virtual const pointField & points() const
Points of surface.
virtual bool update()
Update the surface as required.
Definition: sampledPlane.C:108
virtual void print(Ostream &) const
Write.
Definition: sampledPlane.C:228
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:54
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
Definition: sampledPlane.C:140
const labelList & meshCells() const
For every face original cell in mesh.
Definition: sampledPlane.H:135
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.