cylinderToFace.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) 2017 OpenFOAM Foundation
9  Copyright (C) 2018-2022 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::cylinderToFace
29 
30 Description
31  A \c topoSetFaceSource to select all faces whose face centre
32  inside a given bounding cylinder or cylinder annulus.
33 
34  Operands:
35  \table
36  Operand | Type | Location
37  output | faceSet | $FOAM_CASE/constant/polyMesh/sets/<set>
38  \endtable
39 
40 Usage
41  Minimal example by using \c system/topoSetDict.actions:
42  \verbatim
43  {
44  // Mandatory (inherited) entries
45  name <name>;
46  type faceSet;
47  action <action>;
48 
49  // Mandatory entries
50  source cylinderToFace;
51  point1 (<p1X> <p1Y> <p1Z>);
52  point2 (<p2X> <p2Y> <p2Z>);
53  radius <radius1>; // or outerRadius
54 
55  // Optional entries
56  innerRadius <radius2>;
57  }
58  \endverbatim
59 
60  where the entries mean:
61  \table
62  Property | Description | Type | Req'd | Dflt
63  name | Name of faceSet | word | yes | -
64  type | Type name: faceSet | word | yes | -
65  action | Action applied on faces - see below | word | yes | -
66  source | Source name: cylinderToFace | word | yes | -
67  point1 (p1) | Coordinate of the first endpoint | vector | yes | -
68  point2 (p2) | Coordinate of the second endpoint | vector | yes | -
69  radius | Cylinder outer radius | scalar | yes | -
70  innerRadius | Cylinder inner radius | scalar | no | 0
71  outerRadius | Alternative spelling for 'radius' | scalar | no | -
72  \endtable
73 
74  Options for the \c action entry:
75  \verbatim
76  new | Create a new faceSet from selected faces
77  add | Add selected faces into this faceSet
78  subtract | Remove selected faces from this faceSet
79  \endverbatim
80 
81 See also
82  - Foam::topoSetSource
83  - Foam::topoSetFaceSource
84  - Foam::cylinderAnnulusToFace
85 
86 SourceFiles
87  cylinderToFace.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef Foam_cylinderToFace_H
92 #define Foam_cylinderToFace_H
93 
94 #include "topoSetFaceSource.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class cylinderToFace Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class cylinderToFace
106 :
107  public topoSetFaceSource
108 {
109  // Private Data
110 
111  //- Add usage string
112  static addToUsageTable usage_;
113 
114  //- First point on cylinder axis
115  point point1_;
116 
117  //- Second point on cylinder axis
118  point point2_;
119 
120  //- Outer radius
121  scalar radius_;
122 
123  //- Inner radius
124  scalar innerRadius_;
125 
126 
127  // Private Member Functions
128 
129  void combine(topoSet& set, const bool add) const;
130 
131 protected:
132 
133  // Constructors
134 
135  //- Construct from Istream with mandatory inner radius
137  (
138  const polyMesh& mesh,
139  Istream& is,
140  const bool mandatoryInnerRadius
141  );
142 
143 
144 public:
145 
146  //- Runtime type information
147  TypeName("cylinderToFace");
148 
149 
150  // Constructors
151 
152  //- Construct from components
154  (
155  const polyMesh& mesh,
156  const point& point1,
157  const point& point2,
158  const scalar radius,
159  const scalar innerRadius = 0
160  );
161 
162  //- Construct from dictionary
163  cylinderToFace(const polyMesh& mesh, const dictionary& dict);
164 
165  //- Construct from Istream
166  cylinderToFace(const polyMesh& mesh, Istream& is);
167 
169  //- Destructor
170  virtual ~cylinderToFace() = default;
171 
172 
173  // Member Functions
174 
175  virtual void applyToSet
176  (
177  const topoSetSource::setAction action,
178  topoSet& set
179  ) const;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
dictionary dict
virtual ~cylinderToFace()=default
Destructor.
cylinderToFace(const polyMesh &mesh, Istream &is, const bool mandatoryInnerRadius)
Construct from Istream with mandatory inner radius.
const polyMesh & mesh() const noexcept
Reference to the mesh.
setAction
Enumeration defining various actions.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:59
TypeName("cylinderToFace")
Runtime type information.
vector point
Point is a vector.
Definition: point.H:37
Namespace for OpenFOAM.