sphereRandom.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::sampledSets::sphereRandom
26 
27 Description
28  Random samples within a sphere
29 
30 Usage
31  \table
32  Property | Description | Req'd? | Default
33  centre | Centre of the sphere | yes |
34  radius | Radius of the sphere | yes |
35  nPoints | The number of points | yes |
36  axis | The coordinate axis that is written | yes |
37  \endtable
38 
39  Example specification:
40  \verbatim
41  {
42  type sphereRandom;
43  centre (0.95 0 0.25);
44  radius 0.25;
45  nPoints 200;
46  axis x;
47  }
48  \endverbatim
49 
50 SourceFiles
51  sphereRandom.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef sphereRandom_H
56 #define sphereRandom_H
57 
58 #include "sampledSet.H"
59 #include "DynamicList.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 namespace sampledSets
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class sphereRandom Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class sphereRandom
73 :
74  public sampledSet
75 {
76  // Private Data
77 
78  //- Centre point
79  const point centre_;
80 
81  //- Radius
82  const scalar radius_;
83 
84  //- Number of points
85  const label nPoints_;
86 
87 
88  // Private Member Functions
89 
90  //- Samples all points in sampleCoords
91  void calcSamples
92  (
93  DynamicList<point>& samplingPositions,
94  DynamicList<label>& samplingSegments,
95  DynamicList<label>& samplingCells,
96  DynamicList<label>& samplingFaces
97  ) const;
98 
99  //- Uses calcSamples to obtain samples. Copies them into *this.
100  void genSamples();
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("sphereRandom");
107 
108 
109  // Constructors
110 
111  //- Construct from dictionary
113  (
114  const word& name,
115  const polyMesh& mesh,
116  const meshSearch& searchEngine,
117  const dictionary& dict
118  );
119 
120 
121  // Destructor
122 
123  virtual ~sphereRandom();
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace sampledSets
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
Definition: meshSearch.H:57
dictionary dict
const polyMesh & mesh() const
Access the mesh.
Definition: sampledSet.H:210
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
TypeName("sphereRandom")
Runtime type information.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
A class for handling words, derived from string.
Definition: word.H:59
const word & name() const
Access the name.
Definition: sampledSet.H:204
vector point
Point is a vector.
Definition: point.H:41
const meshSearch & searchEngine() const
Access the search engine.
Definition: sampledSet.H:216
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
sphereRandom(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Definition: sphereRandom.C:118
Namespace for OpenFOAM.