boundaryRandom.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-2024 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::boundaryRandom
26 
27 Description
28  Random samples within patches
29 
30 Usage
31  \table
32  Property | Description | Req'd? | Default
33  patches | The patches on which to sample | yes |
34  nPoints | The number of points | yes |
35  axis | The coordinate axis that is written | yes |
36  \endtable
37 
38  Example specification:
39  \verbatim
40  {
41  type boundaryRandom;
42  patches (inlet1 inlet2);
43  nPoints 1000;
44  axis x;
45  }
46  \endverbatim
47 
48 SourceFiles
49  boundaryRandom.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef boundaryRandom_H
54 #define boundaryRandom_H
55 
56 #include "sampledSet.H"
57 #include "DynamicList.H"
58 #include "HashSet.H"
59 #include "wordReList.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 namespace sampledSets
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class boundaryRandom Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class boundaryRandom
73 :
74  public sampledSet
75 {
76  // Private Data
77 
78  //- Patches to sample
79  const wordReList patches_;
80 
81  //- Number of points
82  const label nPoints_;
83 
84 
85  // Private Member Functions
86 
87  //- Sample all points
88  void calcSamples
89  (
90  DynamicList<point>& samplingPositions,
91  DynamicList<label>& samplingSegments,
92  DynamicList<label>& samplingCells,
93  DynamicList<label>& samplingFaces
94  ) const;
95 
96  //- Use calcSamples to obtain samples and copy them into *this
97  virtual void genSamples();
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("boundaryRandom");
104 
105 
106  // Constructors
107 
108  //- Construct from dictionary
110  (
111  const word& name,
112  const polyMesh& mesh,
113  const meshSearch& searchEngine,
114  const dictionary& dict
115  );
116 
117 
118  //- Destructor
119  virtual ~boundaryRandom();
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace sampledSets
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Definition: meshSearch.H:58
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
const meshSearch & searchEngine() const
Access the search engine.
Definition: sampledSet.H:222
const word & name() const
Access the name.
Definition: sampledSet.H:210
const polyMesh & mesh() const
Access the mesh.
Definition: sampledSet.H:216
boundaryRandom(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
TypeName("boundaryRandom")
Runtime type information.
virtual ~boundaryRandom()
Destructor.
Set of sets to sample. Call sampledSets.write() to sample&write files.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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
List< wordRe > wordReList
A List of wordRe (word or regular expression)
Definition: wordReList.H:50
dictionary dict