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-2014 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
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  // Constructors
116 
117  //- Construct from components
118  uniformSet
119  (
120  const word& name,
121  const polyMesh& mesh,
122  const meshSearch& searchEngine,
123  const word& axis,
124  const point& start,
125  const point& end,
126  const label nPoints
127  );
128 
129  //- Construct from dictionary
130  uniformSet
131  (
132  const word& name,
133  const polyMesh& mesh,
134  const meshSearch& searchEngine,
135  const dictionary& dict
136  );
137 
138 
139  //- Destructor
140  virtual ~uniformSet();
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
Foam::sampledSet
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:64
Foam::coordSet::name
const word & name() const
Definition: coordSet.H:111
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::meshSearch
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Definition: meshSearch.H:57
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
Foam::uniformSet
Definition: uniformSet.H:49
Foam::sampledSet::searchEngine
const meshSearch & searchEngine() const
Definition: sampledSet.H:253
Foam::passiveParticle
Copy of base particle.
Definition: passiveParticle.H:50
Foam::uniformSet::calcSamples
void calcSamples(DynamicList< point > &samplingPts, DynamicList< label > &samplingCells, DynamicList< label > &samplingFaces, DynamicList< label > &samplingSegments, DynamicList< scalar > &samplingCurveDist) const
Samples from start_ to end_. samplingSegments contains segmentNo.
Definition: uniformSet.C:209
Foam::uniformSet::~uniformSet
virtual ~uniformSet()
Destructor.
Definition: uniformSet.C:480
Foam::coordSet::axis
word axis() const
Definition: coordSet.H:116
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
sampledSet.H
Foam::label
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
Foam::uniformSet::trackToBoundary
bool trackToBoundary(passiveParticleCloud &particleCloud, passiveParticle &singleParticle, point &samplePt, label &sampleI, DynamicList< point > &samplingPts, DynamicList< label > &samplingCells, DynamicList< label > &samplingFaces, DynamicList< scalar > &samplingCurveDist) const
Samples from startTrackPt/CellI. Updates particle/samplePt/sampleI.
Definition: uniformSet.C:79
Foam::passiveParticleCloud
A Cloud of passive particles.
Definition: passiveParticleCloud.H:49
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::uniformSet::genSamples
void genSamples()
Uses calcSamples to obtain samples. Copies them into *this.
Definition: uniformSet.C:394
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::uniformSet::nPoints_
label nPoints_
Number of points.
Definition: uniformSet.H:62
Foam::sampledSet::mesh
const polyMesh & mesh() const
Definition: sampledSet.H:248
Foam::uniformSet::TypeName
TypeName("uniform")
Runtime type information.
passiveParticleCloud.H
Foam::Vector< scalar >
Foam::uniformSet::end_
point end_
End point.
Definition: uniformSet.H:59
Foam::uniformSet::start_
point start_
Starting point.
Definition: uniformSet.H:56
Foam::uniformSet::uniformSet
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
DynamicList.H
Foam::uniformSet::nextSample
bool nextSample(const point &currentPt, const vector &offset, const scalar smallDist, point &samplePt, label &sampleI) const
Calculates - starting at samplePt - the first sampling point.
Definition: uniformSet.C:45