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-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::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  p1 (<p1X> <p1Y> <p1Z>);
52  p2 (<p2X> <p2Y> <p2Z>);
53  radius <radius1>;
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  p1 | Coordinate of one of the endpoints | vector | yes | -
68  p2 | Coordinate of the other endpoint | vector | yes | -
69  radius | Cylinder outer radius | scalar | yes | -
70  innerRadius | Cylinder inner radius | scalar | no | 0
71  \endtable
72 
73  Options for the \c action entry:
74  \verbatim
75  new | Create a new pointSet from selected points
76  add | Add selected points into this pointSet
77  subtract | Remove selected points from this pointSet
78  \endverbatim
79 
80 See also
81  - Foam::topoSetSource
82  - Foam::topoSetPointSource
83 
84 SourceFiles
85  cylinderToPoint.C
86 
87 \*---------------------------------------------------------------------------*/
88 
89 #ifndef cylinderToPoint_H
90 #define cylinderToPoint_H
91 
92 #include "topoSetPointSource.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class cylinderToPoint Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 class cylinderToPoint
104 :
105  public topoSetPointSource
106 {
107  // Private Data
108 
109  //- Add usage string
110  static addToUsageTable usage_;
111 
112  //- First point on cylinder axis
113  point point1_;
114 
115  //- Second point on cylinder axis
116  point point2_;
117 
118  //- Outer radius
119  scalar radius_;
120 
121  //- Inner radius
122  scalar innerRadius_;
123 
124 
125  // Private Member Functions
126 
127  void combine(topoSet& set, const bool add) const;
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("cylinderToPoint");
134 
135 
136  // Constructors
137 
138  //- Construct from components
140  (
141  const polyMesh& mesh,
142  const point& point1,
143  const point& point2,
144  const scalar radius,
145  const scalar innerRadius = 0
146  );
147 
148  //- Construct from dictionary
149  cylinderToPoint(const polyMesh& mesh, const dictionary& dict);
150 
151  //- Construct from Istream
152  cylinderToPoint(const polyMesh& mesh, Istream& is);
153 
154 
155  //- Destructor
156  virtual ~cylinderToPoint() = default;
157 
158 
159  // Member Functions
160 
161  virtual void applyToSet
162  (
163  const topoSetSource::setAction action,
165  ) const;
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Foam::cylinderToPoint::~cylinderToPoint
virtual ~cylinderToPoint()=default
Destructor.
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::cylinderToPoint::cylinderToPoint
cylinderToPoint(const polyMesh &mesh, const point &point1, const point &point2, const scalar radius, const scalar innerRadius=0)
Construct from components.
Definition: cylinderToPoint.C:100
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetSource::addToUsageTable
Class with constructor to add usage string to table.
Definition: topoSetSource.H:129
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
Foam::topoSetPointSource
The topoSetPointSource is a intermediate class for handling topoSet sources for selecting points.
Definition: topoSetPointSource.H:54
dict
dictionary dict
Definition: searchingEngine.H:14
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::cylinderToPoint::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: cylinderToPoint.C:150
topoSetPointSource.H
Foam::cylinderToPoint
A topoSetPointSource to select all points which are inside a given bounding cylinder or cylinder annu...
Definition: cylinderToPoint.H:164
Foam::Vector< scalar >
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
Foam::cylinderToPoint::TypeName
TypeName("cylinderToPoint")
Runtime type information.
Foam::point
vector point
Point is a vector.
Definition: point.H:43