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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::sphereToFace
28 
29 Description
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 
39 Usage
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 
77 See also
78  - Foam::topoSetSource
79  - Foam::topoSetFaceSource
80 
81 SourceFiles
82  sphereToFace.C
83 
84 \*---------------------------------------------------------------------------*/
85 
86 #ifndef sphereToFace_H
87 #define sphereToFace_H
88 
89 #include "topoSetFaceSource.H"
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 namespace Foam
94 {
95 
96 /*---------------------------------------------------------------------------*\
97  Class sphereToFace Declaration
98 \*---------------------------------------------------------------------------*/
99 
100 class 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 
124 public:
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
155  (
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 // ************************************************************************* //
Foam::sphereToFace
A topoSetFaceSource to select faces based on face centres inside a given bounding sphere.
Definition: sphereToFace.H:155
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::sphereToFace::TypeName
TypeName("sphereToFace")
Runtime type information.
Foam::combine
Definition: FaceCellWave.C:57
Foam::sphereToFace::~sphereToFace
virtual ~sphereToFace()=default
Destructor.
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::topoSetFaceSource
The topoSetFaceSource is a intermediate class for handling topoSet sources for selecting faces.
Definition: topoSetFaceSource.H:54
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
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::sphereToFace::sphereToFace
sphereToFace(const polyMesh &mesh, const point &origin, const scalar radius, const scalar innerRadius=0)
Construct from components.
Definition: sphereToFace.C:92
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::Vector< scalar >
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
topoSetFaceSource.H
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::sphereToFace::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: sphereToFace.C:138