uniformSet.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 | Copyright (C) 2011-2016 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::uniformSet
26 
27 Description
28 
29 SourceFiles
30  uniformSet.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef uniformSet_H
35 #define uniformSet_H
36 
37 #include "passiveParticleCloud.H"
38 #include "sampledSet.H"
39 #include "DynamicList.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class uniformSet Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class uniformSet
51 :
52  public sampledSet
53 {
54  // Private data
55 
56  //- Starting point
57  point start_;
58 
59  //- End point
60  point end_;
61 
62  //- Number of points
63  label nPoints_;
64 
65  // Private Member Functions
66 
67  //- Calculates - starting at samplePt - the first sampling point
68  // on or after currentPt. smallDist is the tolerance used to compare
69  // positions. Returns false if end of samples reached.
70  bool nextSample
71  (
72  const point& currentPt,
73  const vector& offset,
74  const scalar smallDist,
75  point& samplePt,
76  label& sampleI
77  ) const;
78 
79  //- Samples from startTrackPt/Celli. Updates particle/samplePt/sampleI
80  // and puts
81  // samples in the DynamicLists. Returns false if end of all samples
82  // reached
83  bool trackToBoundary
84  (
85  passiveParticleCloud& particleCloud,
86  passiveParticle& singleParticle,
87  point& samplePt,
88  label& sampleI,
89  DynamicList<point>& samplingPts,
90  DynamicList<label>& samplingCells,
91  DynamicList<label>& samplingFaces,
92  DynamicList<scalar>& samplingCurveDist
93  ) const;
94 
95  //- Samples from start_ to end_. samplingSegments contains segmentNo
96  // for each sample.
97  void calcSamples
98  (
99  DynamicList<point>& samplingPts,
100  DynamicList<label>& samplingCells,
101  DynamicList<label>& samplingFaces,
102  DynamicList<label>& samplingSegments,
103  DynamicList<scalar>& samplingCurveDist
104  ) const;
105 
106  //- Uses calcSamples to obtain samples. Copies them into *this.
107  void genSamples();
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("uniform");
114 
115 
116  // Static data
117 
118  //- Tolerance when comparing points relative to difference between
119  // start_ and end_
120  static const scalar tol;
121 
122 
123  // Constructors
124 
125  //- Construct from components
126  uniformSet
127  (
128  const word& name,
129  const polyMesh& mesh,
130  const meshSearch& searchEngine,
131  const word& axis,
132  const point& start,
133  const point& end,
134  const label nPoints
135  );
136 
137  //- Construct from dictionary
138  uniformSet
139  (
140  const word& name,
141  const polyMesh& mesh,
142  const meshSearch& searchEngine,
143  const dictionary& dict
144  );
145 
146 
147  //- Destructor
148  virtual ~uniformSet();
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
Definition: meshSearch.H:57
dictionary dict
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:137
iterator end()
Return an iterator to end traversing the UList.
Definition: UListI.H:237
A Cloud of passive particles.
virtual ~uniformSet()
Destructor.
Definition: uniformSet.C:480
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:64
uniformSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis, const point &start, const point &end, const label nPoints)
Construct from components.
Definition: uniformSet.C:432
A class for handling words, derived from string.
Definition: word.H:59
label nPoints
TypeName("uniform")
Runtime type information.
const word & name() const
Definition: coordSet.H:111
word axis() const
Definition: coordSet.H:116
const polyMesh & mesh() const
Definition: sampledSet.H:241
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const meshSearch & searchEngine() const
Definition: sampledSet.H:246
static const scalar tol
Tolerance when comparing points relative to difference between.
Definition: uniformSet.H:119
Copy of base particle.
Namespace for OpenFOAM.