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) 2011-2015 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::sampledPlane
26 
27 Description
28  A sampledSurface defined by a cuttingPlane. Triangulated by default.
29 
30 Note
31  Does not actually cut until update() called.
32 
33 SourceFiles
34  sampledPlane.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef sampledPlane_H
39 #define sampledPlane_H
40 
41 #include "sampledSurface.H"
42 #include "cuttingPlane.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class sampledPlane Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class sampledPlane
54 :
55  public sampledSurface,
56  public cuttingPlane
57 {
58  // Private data
59 
60  //- If restricted to zones, name of this zone or a regular expression
62 
63  //- Triangulated faces or keep faces as is
64  const bool triangulate_;
65 
66  //- Track if the surface needs an update
67  mutable bool needsUpdate_;
68 
69  // Private Member Functions
70 
71  //- Sample field on faces
72  template<class Type>
74  (
76  ) const;
77 
78 
79  template<class Type>
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("sampledPlane");
88 
89 
90  // Constructors
91 
92  //- Construct from components
94  (
95  const word& name,
96  const polyMesh& mesh,
97  const plane& planeDesc,
98  const keyType& zoneKey = word::null,
99  const bool triangulate = true
100  );
101 
102  //- Construct from dictionary
104  (
105  const word& name,
106  const polyMesh& mesh,
107  const dictionary& dict
108  );
109 
110 
111  //- Destructor
112  virtual ~sampledPlane();
113 
114 
115  // Member Functions
116 
117  //- Does the surface need an update?
118  virtual bool needsUpdate() const;
119 
120  //- Mark the surface as needing an update.
121  // May also free up unneeded data.
122  // Return false if surface was already marked as expired.
123  virtual bool expire();
124 
125  //- Update the surface as required.
126  // Do nothing (and return false) if no update was needed
127  virtual bool update();
128 
129 
130  //- Points of surface
131  virtual const pointField& points() const
132  {
133  return cuttingPlane::points();
134  }
135 
136  //- Faces of surface
137  virtual const faceList& faces() const
138  {
139  return cuttingPlane::faces();
140  }
141 
142  //- For every face original cell in mesh
143  const labelList& meshCells() const
144  {
145  return cuttingPlane::cutCells();
146  }
147 
148  //- Sample field on surface
149  virtual tmp<scalarField> sample
150  (
151  const volScalarField&
152  ) const;
153 
154 
155  //- Sample field on surface
156  virtual tmp<vectorField> sample
157  (
158  const volVectorField&
159  ) const;
160 
161  //- Sample field on surface
163  (
165  ) const;
166 
167  //- Sample field on surface
169  (
170  const volSymmTensorField&
171  ) const;
172 
173  //- Sample field on surface
174  virtual tmp<tensorField> sample
175  (
176  const volTensorField&
177  ) const;
178 
179 
180  //- Interpolate field on surface
182  (
183  const interpolation<scalar>&
184  ) const;
185 
186 
187  //- Interpolate field on surface
189  (
190  const interpolation<vector>&
191  ) const;
192 
193  //- Interpolate field on surface
195  (
197  ) const;
198 
199  //- Interpolate field on surface
201  (
203  ) const;
204 
205  //- Interpolate field on surface
207  (
208  const interpolation<tensor>&
209  ) const;
210 
211  //- Write
212  virtual void print(Ostream&) const;
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #ifdef NoRepository
223 # include "sampledPlaneTemplates.C"
224 #endif
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
Foam::sampledPlane::update
virtual bool update()
Update the surface as required.
Definition: sampledPlane.C:131
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::cuttingPlane::cutCells
const labelList & cutCells() const
Return List of cells cut by the plane.
Definition: cuttingPlane.H:158
Foam::sampledPlane::expire
virtual bool expire()
Mark the surface as needing an update.
Definition: sampledPlane.C:116
Foam::MeshedSurface< face >::triangulate
virtual label triangulate()
Triangulate in-place, returning the number of triangles added.
Definition: MeshedSurface.C:821
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::cuttingPlane
Constructs plane through mesh.
Definition: cuttingPlane.H:60
Foam::sampledPlane::sampleField
tmp< Field< Type > > sampleField(const GeometricField< Type, fvPatchField, volMesh > &vField) const
Sample field on faces.
Foam::sampledPlane::needsUpdate_
bool needsUpdate_
Track if the surface needs an update.
Definition: sampledPlane.H:66
Foam::sampledPlane::sampledPlane
sampledPlane(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
Foam::sampledPlane::sample
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
Definition: sampledPlane.C:163
Foam::sampledPlane::TypeName
TypeName("sampledPlane")
Runtime type information.
cuttingPlane.H
Foam::MeshedSurface< face >::faces
const List< Face > & faces() const
Return const access to the faces.
Definition: MeshedSurface.H:301
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::plane
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
Foam::sampledPlane::faces
virtual const faceList & faces() const
Faces of surface.
Definition: sampledPlane.H:136
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:56
Foam::sampledPlane::points
virtual const pointField & points() const
Points of surface.
Definition: sampledPlane.H:130
Foam::cuttingPlane::planeDesc
const plane & planeDesc() const
Return plane used.
Definition: cuttingPlane.H:152
Foam::sampledPlane::needsUpdate
virtual bool needsUpdate() const
Does the surface need an update?
Definition: sampledPlane.C:110
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
sampledSurface.H
Foam::sampledPlane::triangulate_
const bool triangulate_
Triangulated faces or keep faces as is.
Definition: sampledPlane.H:63
Foam::sampledSurface
An abstract class for surfaces with sampling.
Definition: sampledSurface.H:77
Foam::interpolation< Type >
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::sampledPlane::meshCells
const labelList & meshCells() const
For every face original cell in mesh.
Definition: sampledPlane.H:142
Foam::sampledPlane::print
virtual void print(Ostream &) const
Write.
Definition: sampledPlane.C:251
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
sampledPlaneTemplates.C
Foam::sampledSurface::name
const word & name() const
Name of surface.
Definition: sampledSurface.H:250
Foam::sampledPlane::interpolateField
tmp< Field< Type > > interpolateField(const interpolation< Type > &) const
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::sampledSurface::mesh
const polyMesh & mesh() const
Access to the underlying mesh.
Definition: sampledSurface.H:244
Foam::sampledPlane::~sampledPlane
virtual ~sampledPlane()
Destructor.
Definition: sampledPlane.C:104
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::sampledPlane
A sampledSurface defined by a cuttingPlane. Triangulated by default.
Definition: sampledPlane.H:52
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::sampledSurface::interpolate
bool interpolate() const
Interpolation requested for surface.
Definition: sampledSurface.H:256
Foam::sampledPlane::zoneKey_
keyType zoneKey_
If restricted to zones, name of this zone or a regular expression.
Definition: sampledPlane.H:60