cylinderToPoint.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::cylinderToPoint
29 
30 Description
31  A \c topoSetPointSource to select all points which are
32  inside a given bounding cylinder or cylinder annulus.
33 
34  Operands:
35  \table
36  Operand | Type | Location
37  output | pointSet | $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 pointSet;
47  action <action>;
48 
49  // Mandatory entries
50  source cylinderToPoint;
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 pointSet | word | yes | -
64  type | Type name: pointSet | word | yes | -
65  action | Action applied on points - see below | word | yes | -
66  source | Source name: cylinderToPoint | 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 pointSet from selected points
77  add | Add selected points into this pointSet
78  subtract | Remove selected points from this pointSet
79  \endverbatim
80 
81 See also
82  - Foam::topoSetSource
83  - Foam::topoSetPointSource
84 
85 SourceFiles
86  cylinderToPoint.C
87 
88 \*---------------------------------------------------------------------------*/
89 
90 #ifndef Foam_cylinderToPoint_H
91 #define Foam_cylinderToPoint_H
92 
93 #include "topoSetPointSource.H"
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 namespace Foam
98 {
99 
100 /*---------------------------------------------------------------------------*\
101  Class cylinderToPoint Declaration
102 \*---------------------------------------------------------------------------*/
103 
104 class cylinderToPoint
105 :
106  public topoSetPointSource
107 {
108  // Private Data
109 
110  //- Add usage string
111  static addToUsageTable usage_;
112 
113  //- First point on cylinder axis
114  point point1_;
115 
116  //- Second point on cylinder axis
117  point point2_;
118 
119  //- Outer radius
120  scalar radius_;
121 
122  //- Inner radius
123  scalar innerRadius_;
124 
125 
126  // Private Member Functions
127 
128  void combine(topoSet& set, const bool add) const;
129 
130 protected:
131 
132  // Constructors
133 
134  //- Construct from Istream with mandatory inner radius
136  (
137  const polyMesh& mesh,
138  Istream& is,
139  const bool mandatoryInnerRadius
140  );
141 
142 
143 public:
144 
145  //- Runtime type information
146  TypeName("cylinderToPoint");
147 
148 
149  // Constructors
150 
151  //- Construct from components
153  (
154  const polyMesh& mesh,
155  const point& point1,
156  const point& point2,
157  const scalar radius,
158  const scalar innerRadius = 0
159  );
160 
161  //- Construct from dictionary
162  cylinderToPoint(const polyMesh& mesh, const dictionary& dict);
163 
164  //- Construct from Istream
165  cylinderToPoint(const polyMesh& mesh, Istream& is);
166 
168  //- Destructor
169  virtual ~cylinderToPoint() = default;
170 
171 
172  // Member Functions
173 
174  virtual void applyToSet
175  (
176  const topoSetSource::setAction action,
177  topoSet& set
178  ) const;
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
dictionary dict
virtual ~cylinderToPoint()=default
Destructor.
cylinderToPoint(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
vector point
Point is a vector.
Definition: point.H:37
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Namespace for OpenFOAM.
TypeName("cylinderToPoint")
Runtime type information.