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