planeToFaceZone.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::planeToFaceZone
29 
30 Description
31  A \c topoSetSource to select faces based on the adjacent cell centres
32  spanning a given plane. The plane is defined by a point and normal vector.
33 
34  Operands:
35  \table
36  Operand | Type | Location
37  output 1 | faceSet | <constant>/polyMesh/sets/<set>
38  output 2 | faceZone | <constant>/polyMesh/faceZones
39  \endtable
40 
41 Usage
42  Minimal example by using \c system/topoSetDict.actions:
43  \verbatim
44  {
45  // Mandatory (inherited) entries
46  name <name>;
47  type faceZoneSet;
48  action <action>;
49 
50  // Mandatory entries
51  source planeToFaceZone;
52  point (<px> <py> <pz>);
53  normal (<nx> <ny> <nz>);
54 
55  // Optional entries
56  option <option>;
57  }
58  \endverbatim
59 
60  where the entries mean:
61  \table
62  Property | Description | Type | Reqd | Dflt
63  name | Name of faceZone | word | yes | -
64  type | Type name: faceZoneSet | word | yes | -
65  action | Action applied on faces - see below | word | yes | -
66  source | Source name: planeToFaceZone | word | yes | -
67  point | A point on the input plane | vector | yes | -
68  normal | Normal vector to the input plane | vector | yes | -
69  option | Plane selection method - see below | word | no | all
70  \endtable
71 
72  Options for the \c action entry:
73  \verbatim
74  new | Create a new faceZone from selected faces of a faceZone
75  add | Add selected faces of a faceZone into this faceZone
76  subtract | Remove selected faces of a faceZone from this faceZone
77  \endverbatim
78 
79  Options for the \c option entry:
80  \verbatim
81  all | Select all faces that meet the criteria
82  closest | Select faces that belong to the closest contiguous plane
83  \endverbatim
84 
85 Note
86  - Additionally, an include entry can be specified. When omitted or set to
87  "all", then all faces that meet the criteria are included in the set. When
88  set to "closest", just the faces that belong to the closest contiguous
89  region to the plane point are included. This latter setting is useful when
90  defining face zones through channels on which the flow rate is to be
91  computed, as it keeps the set local to a single channel.
92 
93 See also
94  - Foam::topoSetSource
95 
96 SourceFiles
97  planeToFaceZone.C
98 
99 \*---------------------------------------------------------------------------*/
100 
101 #ifndef planeToFaceZone_H
102 #define planeToFaceZone_H
103 
104 #include "topoSetFaceZoneSource.H"
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 namespace Foam
109 {
110 
111 /*---------------------------------------------------------------------------*\
112  Class planeToFaceZone Declaration
113 \*---------------------------------------------------------------------------*/
114 
115 class planeToFaceZone
116 :
117  public topoSetFaceZoneSource
118 {
119 public:
120 
121  //- Enumeration defining the valid options
122  enum faceAction
123  {
124  ALL,
125  CLOSEST
126  };
127 
128 
129 private:
130 
131  // Private Data
132 
133  //- Add usage string
134  static addToUsageTable usage_;
135 
136  //- Plane selection methods
137  static const Enum<faceAction> faceActionNames_;
138 
139  //- Point on the input plane
140  const vector point_;
141 
142  //- Normal to the input plane
143  const vector normal_;
144 
145  //- Input plane selection method
146  const faceAction option_;
147 
148 
149  // Private Member Functions
150 
151  void combine(faceZoneSet& set, const bool add) const;
152 
153 
154 public:
155 
156  //- Runtime type information
157  TypeName("planeToFaceZone");
158 
159 
160  // Constructors
161 
162  //- No default construct
163  planeToFaceZone() = delete;
164 
165  //- Construct from components
167  (
168  const polyMesh& mesh,
169  const point& basePoint,
170  const vector& normal,
171  const faceAction action = faceAction::ALL
172  );
173 
174  //- Construct from dictionary
175  planeToFaceZone(const polyMesh& mesh, const dictionary& dict);
176 
177  //- Construct from Istream
178  planeToFaceZone(const polyMesh& mesh, Istream& is);
179 
180 
181  //- Destructor
182  virtual ~planeToFaceZone() = default;
183 
184 
185  // Member Functions
186 
187  virtual void applyToSet
188  (
189  const topoSetSource::setAction action,
190  topoSet&
191  ) const;
192 };
193 
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
Foam::planeToFaceZone::faceAction
faceAction
Enumeration defining the valid options.
Definition: planeToFaceZone.H:181
Foam::Enum< faceAction >
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetFaceZoneSource
The topoSetFaceZoneSource is a intermediate class for handling topoSet sources for selecting face zon...
Definition: topoSetFaceZoneSource.H:57
Foam::planeToFaceZone
A topoSetSource to select faces based on the adjacent cell centres spanning a given plane....
Definition: planeToFaceZone.H:174
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::planeToFaceZone::planeToFaceZone
planeToFaceZone()=delete
No default construct.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::planeToFaceZone::ALL
Select all faces that meet the criteria.
Definition: planeToFaceZone.H:183
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::planeToFaceZone::CLOSEST
Select faces belong to the closest contiguous plane.
Definition: planeToFaceZone.H:184
Foam::planeToFaceZone::TypeName
TypeName("planeToFaceZone")
Runtime type information.
Foam::faceZoneSet
Like faceSet but -reads data from faceZone -updates faceZone when writing.
Definition: faceZoneSet.H:51
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
dict
dictionary dict
Definition: searchingEngine.H:14
topoSetFaceZoneSource.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::planeToFaceZone::~planeToFaceZone
virtual ~planeToFaceZone()=default
Destructor.
Foam::planeToFaceZone::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Apply specified action to the topoSet.
Definition: planeToFaceZone.C:415
Foam::Vector< scalar >
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
Foam::point
vector point
Point is a vector.
Definition: point.H:43