sphereToFace.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) 2018-2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::sphereToFace
28
29Description
30 A \c topoSetFaceSource to select faces based
31 on face centres inside a given bounding sphere.
32
33 Operands:
34 \table
35 Operand | Type | Location
36 output | faceSet | $FOAM_CASE/constant/polyMesh/sets/<set>
37 \endtable
38
39Usage
40 Minimal example by using \c system/topoSetDict.actions:
41 \verbatim
42 {
43 // Mandatory (inherited) entries
44 name <name>;
45 type faceSet;
46 action <action>;
47
48 // Mandatory entries
49 source sphereToFace;
50 origin (0 0 0);
51 radius 0.5;
52
53 // Optional entries
54 innerRadius 0;
55 }
56 \endverbatim
57
58 where the entries mean:
59 \table
60 Property | Description | Type | Req'd | Dflt
61 name | Name of faceSet | word | yes | -
62 type | Type name: faceSet | word | yes | -
63 action | Action applied on faces - see below | word | yes | -
64 source | Source name: sphereToFace | word | yes | -
65 origin | The origin (centre) of the sphere | vector | yes | -
66 radius | The (outer) radius of sphere | scalar | yes | -
67 innerRadius | The inner radius of sphere | scalar | no | 0
68 \endtable
69
70 Options for the \c action entry:
71 \verbatim
72 new | Create a new faceSet from selected faces
73 add | Add selected faces into this faceSet
74 subtract | Remove selected faces from this faceSet
75 \endverbatim
76
77See also
78 - Foam::topoSetSource
79 - Foam::topoSetFaceSource
80
81SourceFiles
82 sphereToFace.C
83
84\*---------------------------------------------------------------------------*/
85
86#ifndef sphereToFace_H
87#define sphereToFace_H
88
89#include "topoSetFaceSource.H"
90
91// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92
93namespace Foam
94{
95
96/*---------------------------------------------------------------------------*\
97 Class sphereToFace Declaration
98\*---------------------------------------------------------------------------*/
99
100class sphereToFace
101:
102 public topoSetFaceSource
103{
104 // Private Data
105
106 //- Add usage string
107 static addToUsageTable usage_;
108
109 //- Centre point of the sphere
110 point origin_;
111
112 //- The outer radius of the sphere
113 scalar radius_;
114
115 //- The inner radius of the sphere
116 scalar innerRadius_;
117
118
119 // Private Member Functions
120
121 void combine(topoSet& set, const bool add) const;
122
123
124public:
125
126 //- Runtime type information
127 TypeName("sphereToFace");
128
129
130 // Constructors
131
132 //- Construct from components
134 (
135 const polyMesh& mesh,
136 const point& origin,
137 const scalar radius,
138 const scalar innerRadius = 0
139 );
140
141 //- Construct from dictionary
142 sphereToFace(const polyMesh& mesh, const dictionary& dict);
143
144 //- Construct from Istream
145 sphereToFace(const polyMesh& mesh, Istream& is);
146
147
148 //- Destructor
149 virtual ~sphereToFace() = default;
150
151
152 // Member Functions
153
154 virtual void applyToSet
156 const topoSetSource::setAction action,
157 topoSet& set
158 ) const;
159};
160
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164} // End namespace Foam
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168#endif
169
170// ************************************************************************* //
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 topoSetFaceSource to select faces based on face centres inside a given bounding sphere.
Definition: sphereToFace.H:158
virtual ~sphereToFace()=default
Destructor.
sphereToFace(const polyMesh &mesh, const point &origin, const scalar radius, const scalar innerRadius=0)
Construct from components.
Definition: sphereToFace.C:92
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: sphereToFace.C:138
TypeName("sphereToFace")
Runtime type information.
The topoSetFaceSource is a intermediate class for handling topoSet sources for selecting faces.
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