sphereToPoint.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 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::sphereToPoint
28 
29 Description
30  A topoSetPointSource to select based on mesh points inside sphere.
31 
32  \heading Dictionary parameters
33  \table
34  Property | Description | Required | Default
35  origin | The origin (centre) of the sphere | yes |
36  radius | The (outer) radius of sphere | yes |
37  innerRadius | The inner radius of sphere | no | 0
38  centre | Alternative for 'origin' | no |
39  \endtable
40 
41 SourceFiles
42  sphereToPoint.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef sphereToPoint_H
47 #define sphereToPoint_H
48 
49 #include "topoSetPointSource.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class sphereToPoint Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class sphereToPoint
61 :
62  public topoSetPointSource
63 {
64 
65  // Private data
66 
67  //- Add usage string
68  static addToUsageTable usage_;
69 
70  //- Centre point of the sphere
71  point origin_;
72 
73  //- The outer radius of the sphere
74  scalar radius_;
75 
76  //- The inner radius of the sphere
77  scalar innerRadius_;
78 
79 
80  // Private Member Functions
81 
82  void combine(topoSet& set, const bool add) const;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("sphereToPoint");
89 
90 
91  // Constructors
92 
93  //- Construct from components
95  (
96  const polyMesh& mesh,
97  const point& origin,
98  const scalar radius,
99  const scalar innerRadius = 0
100  );
101 
102  //- Construct from dictionary
103  sphereToPoint(const polyMesh& mesh, const dictionary& dict);
104 
105  //- Construct from Istream
106  sphereToPoint(const polyMesh& mesh, Istream& is);
107 
108 
109  //- Destructor
110  virtual ~sphereToPoint() = default;
111 
112 
113  // Member Functions
114 
115  virtual void applyToSet
116  (
117  const topoSetSource::setAction action,
118  topoSet& set
119  ) const;
120 
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
Foam::sphereToPoint::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: sphereToPoint.C:138
Foam::combine
Definition: FaceCellWave.C:56
Foam::sphereToPoint::sphereToPoint
sphereToPoint(const polyMesh &mesh, const point &origin, const scalar radius, const scalar innerRadius=0)
Construct from components.
Definition: sphereToPoint.C:92
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:99
Foam::topoSetSource::mesh
const polyMesh & mesh() const
Reference to the mesh.
Definition: topoSetSource.H:333
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::sphereToPoint::TypeName
TypeName("sphereToPoint")
Runtime type information.
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:66
Foam::topoSetPointSource
Base class of a topoSet source for selecting points.
Definition: topoSetPointSource.H:50
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:121
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::sphereToPoint::~sphereToPoint
virtual ~sphereToPoint()=default
Destructor.
topoSetPointSource.H
Foam::Vector< scalar >
Foam::sphereToPoint
A topoSetPointSource to select based on mesh points inside sphere.
Definition: sphereToPoint.H:84
Foam::point
vector point
Point is a vector.
Definition: point.H:43