polyLineSet.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::polyLineSet
28 
29 Description
30  Sample along poly line defined by a list of points (knots)
31 
32  For a dictionary specification:
33  \table
34  Property | Description | Required | Default
35  type | polyLine | yes |
36  axis | x, y, z, xyz, distance | yes |
37  points | The locations | yes |
38  \endtable
39 
40 SourceFiles
41  polyLineSet.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef polyLineSet_H
46 #define polyLineSet_H
47 
48 #include "sampledSet.H"
49 #include "DynamicList.H"
50 #include "passiveParticleCloud.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class polyLineSet Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class polyLineSet
62 :
63  public sampledSet
64 {
65  // Private data
66 
67  //- Sampling points
68  pointField sampleCoords_;
69 
70 
71  // Private Member Functions
72 
73  //- Sample till hits boundary. Called with singleParticle at position
74  // inbetween sampleCoords_[sampleI] and sampleCoords_[sampleI+1].
75  // Returns false if end of samples reached.
76  bool trackToBoundary
77  (
78  passiveParticleCloud& particleCloud,
79  passiveParticle& singleParticle,
80  label& sampleI,
81  DynamicList<point>& samplingPts,
82  DynamicList<label>& samplingCells,
83  DynamicList<label>& samplingFaces,
84  DynamicList<scalar>& samplingCurveDist
85  ) const;
86 
87  //- Samples all point in sampleCoords_
88  // samplingSegments contains segmentNo for each sample.
89  void calcSamples
90  (
91  DynamicList<point>& samplingPts,
92  DynamicList<label>& samplingCells,
93  DynamicList<label>& samplingFaces,
94  DynamicList<label>& samplingSegments,
95  DynamicList<scalar>& samplingCurveDist
96  ) const;
97 
98  //- Uses calcSamples to obtain samples. Copies them into *this.
99  void genSamples();
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("polyLine");
106 
107 
108  // Static data
109 
110  //- Tolerance when comparing points relative to difference between
111  //- start and end points
112  static const scalar tol;
113 
114 
115  // Constructors
116 
117  //- Construct from components
119  (
120  const word& name,
121  const polyMesh& mesh,
122  const meshSearch& searchEngine,
123  const word& axis,
124  const List<point>& samplePoints
125  );
126 
127  //- Construct from dictionary
129  (
130  const word& name,
131  const polyMesh& mesh,
132  const meshSearch& searchEngine,
133  const dictionary& dict
134  );
135 
136 
137  //- Destructor
138  virtual ~polyLineSet() = default;
139 };
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
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::polyLineSet::tol
static const scalar tol
Definition: polyLineSet.H:131
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::DynamicList< point >
Foam::sampledSet::searchEngine
const meshSearch & searchEngine() const
Definition: sampledSet.H:286
Foam::passiveParticle
Copy of base particle.
Definition: passiveParticle.H:53
Foam::polyLineSet
Sample along poly line defined by a list of points (knots)
Definition: polyLineSet.H:80
Foam::coordSet::axis
word axis() const
Definition: coordSet.H:130
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::polyLineSet::~polyLineSet
virtual ~polyLineSet()=default
Destructor.
sampledSet.H
Foam::Field< vector >
Foam::polyLineSet::TypeName
TypeName("polyLine")
Runtime type information.
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:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::polyLineSet::polyLineSet
polyLineSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis, const List< point > &samplePoints)
Construct from components.
Definition: polyLineSet.C:349
Foam::sampledSet::mesh
const polyMesh & mesh() const
Definition: sampledSet.H:281
passiveParticleCloud.H
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
DynamicList.H