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