patchSeedSet.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) 2012-2014 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::patchSeedSet
28 
29 Description
30  Initialises points on or just off patch
31 
32  For a dictionary specification:
33  \table
34  Property | Description | Required | Default
35  type | patchSeed | yes |
36  axis | x, y, z, xyz, distance | yes |
37  patches | List of patch names or regexs | yes |
38  maxPoints | Max number of points to seed | yes |
39  points | List of selected locations | no | empty
40  \endtable
41 
42 SourceFiles
43  patchSeedSet.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef patchSeedSet_H
48 #define patchSeedSet_H
49 
50 #include "sampledSet.H"
51 #include "DynamicList.H"
52 #include "HashSet.H"
53 #include "Random.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class patchSeedSet Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class patchSeedSet
65 :
66  public sampledSet
67 {
68  // Private data
69 
70  //- Patches to sample
71  const labelHashSet patchSet_;
72 
73  //- Maximum number of patch faces to seed (if in random subset mode)
74  const label maxPoints_;
75 
76  //- Random number generator (if maxPoints < num patch faces)
77  autoPtr<Random> rndGenPtr_;
78 
79  //- Patch faces to seed selected based on nearness to supplied points
80  const pointField selectedLocations_;
81 
82 
83  // Private Member Functions
84 
85  //- Samples all points in sampleCoords.
86  void calcSamples
87  (
88  DynamicList<point>& samplingPts,
89  DynamicList<label>& samplingCells,
90  DynamicList<label>& samplingFaces,
91  DynamicList<label>& samplingSegments,
92  DynamicList<scalar>& samplingCurveDist
93  );
94 
95  //- Uses calcSamples to obtain samples. Copies them into *this.
96  void genSamples();
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("patchSeed");
103 
104 
105  // Constructors
106 
107  //- Construct from dictionary
109  (
110  const word& name,
111  const polyMesh& mesh,
112  const meshSearch& searchEngine,
113  const dictionary& dict
114  );
115 
116 
117  //- Destructor
118  virtual ~patchSeedSet() = default;
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
Foam::sampledSet
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:83
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::coordSet::name
const word & name() const
Definition: coordSet.H:125
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::meshSearch
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Definition: meshSearch.H:60
Foam::patchSeedSet
Initialises points on or just off patch.
Definition: patchSeedSet.H:93
Foam::DynamicList< point >
Foam::sampledSet::searchEngine
const meshSearch & searchEngine() const
Definition: sampledSet.H:286
Foam::patchSeedSet::patchSeedSet
patchSeedSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Definition: patchSeedSet.C:336
Foam::patchSeedSet::TypeName
TypeName("patchSeed")
Runtime type information.
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
sampledSet.H
Foam::Field< vector >
HashSet.H
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:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Random.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::patchSeedSet::~patchSeedSet
virtual ~patchSeedSet()=default
Destructor.
Foam::sampledSet::mesh
const polyMesh & mesh() const
Definition: sampledSet.H:281
DynamicList.H
Foam::labelHashSet
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition: HashSet.H:85