cylinderToCell.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-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::cylinderToCell
29
30Description
31 A \c topoSetCellSource to select all cells whose cell centre
32 inside a given bounding cylinder or cylinder annulus.
33
34 Operands:
35 \table
36 Operand | Type | Location
37 output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
38 \endtable
39
40Usage
41 Minimal example by using \c system/topoSetDict.actions:
42 \verbatim
43 {
44 // Mandatory (inherited) entries
45 name <name>;
46 type cellSet;
47 action <action>;
48
49 // Mandatory entries
50 source cylinderToCell;
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 cellSet | word | yes | -
64 type | Type name: cellSet | word | yes | -
65 action | Action applied on cells - see below | word | yes | -
66 source | Source name: cylinderToCell | 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 cellSet from selected cells
77 add | Add selected cells into this cellSet
78 subtract | Remove selected cells from this cellSet
79 \endverbatim
80
81See also
82 - Foam::topoSetSource
83 - Foam::topoSetCellSource
84 - Foam::cylinderAnnulusToCell
85
86SourceFiles
87 cylinderToCell.C
88
89\*---------------------------------------------------------------------------*/
90
91#ifndef Foam_cylinderToCell_H
92#define Foam_cylinderToCell_H
93
94#include "topoSetCellSource.H"
95
96// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97
98namespace Foam
99{
100
101/*---------------------------------------------------------------------------*\
102 Class cylinderToCell Declaration
103\*---------------------------------------------------------------------------*/
104
105class cylinderToCell
106:
107 public topoSetCellSource
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
132protected:
133
134 // Constructors
135
136 //- Construct from Istream with mandatory inner radius
138 (
139 const polyMesh& mesh,
140 Istream& is,
141 const bool mandatoryInnerRadius
142 );
143
144
145public:
146
147 //- Runtime type information
148 TypeName("cylinderToCell");
149
150
151 // Constructors
152
153 //- Construct from components
155 (
156 const polyMesh& mesh,
157 const point& point1,
158 const point& point2,
159 const scalar radius,
160 const scalar innerRadius = 0
161 );
162
163 //- Construct from dictionary
164 cylinderToCell(const polyMesh& mesh, const dictionary& dict);
165
166 //- Construct from Istream
167 cylinderToCell(const polyMesh& mesh, Istream& is);
168
169
170 //- Destructor
171 virtual ~cylinderToCell() = default;
173
174 // Member Functions
175
176 virtual void applyToSet
177 (
178 const topoSetSource::setAction action,
179 topoSet& set
180 ) const;
181};
182
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186} // End namespace Foam
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190#endif
191
192// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A topoSetCellSource to select all cells whose cell centre inside a given bounding cylinder or cylinde...
TypeName("cylinderToCell")
Runtime type information.
cylinderToCell(const polyMesh &mesh, Istream &is, const bool mandatoryInnerRadius)
Construct from Istream with mandatory inner radius.
virtual ~cylinderToCell()=default
Destructor.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
Class with constructor to add usage string to table.
setAction
Enumeration defining various actions.
const polyMesh & mesh() const noexcept
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:67
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition: point.H:43
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73