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-2019 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>& samplingPts,
99  DynamicList<label>& samplingCells,
100  DynamicList<label>& samplingFaces,
101  DynamicList<label>& samplingSegments,
102  DynamicList<scalar>& samplingCurveDist
103  ) const;
104 
105  //- Uses calcSamples to obtain samples. Copies them into *this.
106  void genSamples();
107 
108 
109 public:
110 
111  //- Runtime type information
112  TypeName("circleRandom");
113 
114 
115  // Constructors
116 
117  //- Construct from dictionary
119  (
120  const word& name,
121  const polyMesh& mesh,
122  const meshSearch& searchEngine,
123  const dictionary& dict
124  );
125 
126 
127  // Destructor
128 
129  virtual ~circleRandom();
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace sampledSets
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
Definition: meshSearch.H:57
dictionary dict
const polyMesh & mesh() const
Definition: sampledSet.H:194
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
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:126
A class for handling words, derived from string.
Definition: word.H:59
TypeName("circleRandom")
Runtime type information.
const word & name() const
Definition: coordSet.H:111
vector point
Point is a vector.
Definition: point.H:41
const meshSearch & searchEngine() const
Definition: sampledSet.H:199
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.