circleRandom.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::circleRandom
26 
27 Description
28  Random samples within a circle
29 
30 Usage
31  \table
32  Property | Description | Req'd? | Default
33  centre | Centre of the circle | yes |
34  normal | Direction normal to the plane of the circle | yes |
35  radius | Radius of the circle | yes |
36  nPoints | The number of points | yes |
37  axis | The coordinate axis that is written | yes |
38  \endtable
39 
40  Example specification:
41  \verbatim
42  {
43  type circleRandom;
44  centre (0.95 0 0.25);
45  normal (1 0 0);
46  radius 0.25;
47  nPoints 200;
48  axis x;
49  }
50  \endverbatim
51 
52 SourceFiles
53  circleRandom.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef circleRandom_H
58 #define circleRandom_H
59 
60 #include "sampledSet.H"
61 #include "DynamicList.H"
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 namespace sampledSets
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class circleRandom Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 class circleRandom
75 :
76  public sampledSet
77 {
78  // Private Data
79 
80  //- Centre point
81  const point centre_;
82 
83  //- Direction normal to the circle
84  const vector normal_;
85 
86  //- Radius
87  const scalar radius_;
88 
89  //- Number of points
90  const label nPoints_;
91 
92 
93  // Private Member Functions
94 
95  //- Samples all points in sampleCoords
96  void calcSamples
97  (
98  DynamicList<point>& samplingPositions,
99  DynamicList<label>& samplingSegments,
100  DynamicList<label>& samplingCells,
101  DynamicList<label>& samplingFaces
102  ) const;
104  //- Uses calcSamples to obtain samples. Copies them into *this.
105  void genSamples();
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("circleRandom");
112 
113 
114  // Constructors
115 
116  //- Construct from dictionary
118  (
119  const word& name,
120  const polyMesh& mesh,
121  const meshSearch& searchEngine,
122  const dictionary& dict
123  );
124 
125 
126  // Destructor
127 
128  virtual ~circleRandom();
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace sampledSets
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
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
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
circleRandom(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Definition: circleRandom.C:119
A class for handling words, derived from string.
Definition: word.H:59
TypeName("circleRandom")
Runtime type information.
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
Namespace for OpenFOAM.