sphereToCell.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-------------------------------------------------------------------------------
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::sphereToCell
29
30Description
31 A \c topoSetCellSource to select cells based
32 on cell centres inside a given bounding sphere.
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 sphereToCell;
51 origin (0 0 0);
52 radius 0.5;
53
54 // Optional entries
55 innerRadius 0;
56 }
57 \endverbatim
58
59 where the entries mean:
60 \table
61 Property | Description | Type | Req'd | Dflt
62 name | Name of cellSet | word | yes | -
63 type | Type name: cellSet | word | yes | -
64 action | Action applied on cells - see below | word | yes | -
65 source | Source name: sphereToCell | word | yes | -
66 origin | The origin (centre) of the sphere | vector | yes | -
67 radius | The (outer) radius of sphere | scalar | yes | -
68 innerRadius | The inner radius of sphere | scalar | no | 0
69 \endtable
70
71 Options for the \c action entry:
72 \verbatim
73 new | Create a new cellSet from selected cells
74 add | Add selected cells into this cellSet
75 subtract | Remove selected cells from this cellSet
76 \endverbatim
77
78See also
79 - Foam::topoSetSource
80 - Foam::topoSetCellSource
81
82SourceFiles
83 sphereToCell.C
84
85\*---------------------------------------------------------------------------*/
86
87#ifndef sphereToCell_H
88#define sphereToCell_H
89
90#include "topoSetCellSource.H"
91
92// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93
94namespace Foam
95{
96
97/*---------------------------------------------------------------------------*\
98 Class sphereToCell Declaration
99\*---------------------------------------------------------------------------*/
100
101class sphereToCell
102:
103 public topoSetCellSource
104{
105 // Private Data
106
107 //- Add usage string
108 static addToUsageTable usage_;
109
110 //- Centre point of the sphere
111 point origin_;
112
113 //- The outer radius of the sphere
114 scalar radius_;
115
116 //- The inner radius of the sphere
117 scalar innerRadius_;
118
119
120 // Private Member Functions
121
122 void combine(topoSet& set, const bool add) const;
123
124
125public:
126
127 //- Runtime type information
128 TypeName("sphereToCell");
129
130
131 // Constructors
132
133 //- Construct from components
135 (
136 const polyMesh& mesh,
137 const point& origin,
138 const scalar radius,
139 const scalar innerRadius = 0
140 );
141
142 //- Construct from dictionary
143 sphereToCell(const polyMesh& mesh, const dictionary& dict);
144
145 //- Construct from Istream
146 sphereToCell(const polyMesh& mesh, Istream& is);
147
148
149 //- Destructor
150 virtual ~sphereToCell() = default;
151
152
153 // Member Functions
154
155 virtual void applyToSet
157 const topoSetSource::setAction action,
158 topoSet& set
159 ) const;
160};
161
162
163// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164
165} // End namespace Foam
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169#endif
170
171// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
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
A topoSetCellSource to select cells based on cell centres inside a given bounding sphere.
Definition: sphereToCell.H:159
sphereToCell(const polyMesh &mesh, const point &origin, const scalar radius, const scalar innerRadius=0)
Construct from components.
Definition: sphereToCell.C:93
virtual ~sphereToCell()=default
Destructor.
TypeName("sphereToCell")
Runtime type information.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: sphereToCell.C:139
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