planeToFaceZone.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) 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::planeToFaceZone
26 
27 Description
28  A topoSetSource to select faces based on the adjacent cell centres spanning
29  a given plane. The plane is defined by a point and normal vector.
30 
31  Additionally, an include entry can be specified. When omitted or set to
32  "all", then all faces that meet the criteria are included in the set. When
33  set to "closest", just the faces that belong to the closest contiguous
34  region to the plane point are included. This latter setting is useful when
35  defining face zones through channels on which the flow rate is to be
36  computed, as it keeps the set local to a single channel.
37 
38 SourceFiles
39  planeToFaceZone.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef planeToFaceZone_H
44 #define planeToFaceZone_H
45 
46 #include "topoSetSource.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 class faceZoneSet;
54 
55 /*---------------------------------------------------------------------------*\
56  Class planeToFaceZone Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class planeToFaceZone
60 :
61  public topoSetSource
62 {
63  public:
64 
65  //- Enumeration for what to include
66  enum include
67  {
68  all,
69  closest
70  };
71 
72  //- Included region names
74 
75 
76 private:
77 
78  // Private Data
79 
80  //- Add usage string
81  static addToUsageTable usage_;
82 
83  //- Point on the plane
84  const vector point_;
85 
86  //- Normal to the plane
87  const vector normal_;
88 
89  //- Included regions
90  const include include_;
91 
92 
93  // Private Member Functions
94 
95  void combine(faceZoneSet& set, const bool add) const;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("planeToFaceZone");
102 
103  // Constructors
104 
105  //- Construct from dictionary
107  (
108  const polyMesh& mesh,
109  const dictionary& dict
110  );
111 
112  //- Construct from Istream
114  (
115  const polyMesh& mesh,
116  Istream&
117  );
118 
119 
120  //- Destructor
121  virtual ~planeToFaceZone();
122 
123 
124  // Member Functions
126  virtual sourceType setType() const
127  {
128  return FACESETSOURCE;
129  }
130 
131  virtual void applyToSet
132  (
133  const topoSetSource::setAction action,
134  topoSet&
135  ) const;
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
virtual sourceType setType() const
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Base class of a source for a topoSet.
Definition: topoSetSource.H:63
const polyMesh & mesh() const
static const NamedEnum< include, 2 > includeNames_
Included region names.
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:82
virtual ~planeToFaceZone()
Destructor.
include
Enumeration for what to include.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Like faceSet but -reads data from faceZone -updates faceZone when writing.
Definition: faceZoneSet.H:49
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:61
TypeName("planeToFaceZone")
Runtime type information.
Class with constructor to add usage string to table.
sourceType
Enumeration defining the types of sources.
Definition: topoSetSource.H:70
A topoSetSource to select faces based on the adjacent cell centres spanning a given plane...
planeToFaceZone(const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Namespace for OpenFOAM.