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