Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / sampling / sampledSet / uniform / uniformSet.H
bloba01af1b0b5f0c137326bd2d8ca26bd8239b45c57
1 /*---------------------------------------------------------------------------* \
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2011 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Class
25     Foam::uniformSet
27 Description
29 SourceFiles
30     uniformSet.C
32 \*---------------------------------------------------------------------------*/
34 #ifndef uniformSet_H
35 #define uniformSet_H
37 #include "passiveParticleCloud.H"
38 #include "sampledSet.H"
39 #include "DynamicList.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 /*---------------------------------------------------------------------------*\
47                            Class uniformSet Declaration
48 \*---------------------------------------------------------------------------*/
50 class uniformSet
52     public sampledSet
54     // Private data
56         //- Starting point
57         point start_;
59         //- End point
60         point end_;
62         //- Number of points
63         label nPoints_;
65     // Private Member Functions
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;
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             passiveParticle& singleParticle,
86             point& samplePt,
87             label& sampleI,
88             DynamicList<point>& samplingPts,
89             DynamicList<label>& samplingCells,
90             DynamicList<label>& samplingFaces,
91             DynamicList<scalar>& samplingCurveDist
92         ) const;
94         //- Samples from start_ to end_. samplingSegments contains segmentNo
95         //  for each sample.
96         void calcSamples
97         (
98             DynamicList<point>& samplingPts,
99             DynamicList<label>& samplingCells,
100             DynamicList<label>& samplingFaces,
101             DynamicList<label>& samplingSegments,
102             DynamicList<scalar>& samplingCurveDist
103         ) const;
105         //- Uses calcSamples to obtain samples. Copies them into *this.
106         void genSamples();
109 public:
111     //- Runtime type information
112     TypeName("uniform");
114     // Constructors
116         //- Construct from components
117         uniformSet
118         (
119             const word& name,
120             const polyMesh& mesh,
121             meshSearch& searchEngine,
122             const word& axis,
123             const point& start,
124             const point& end,
125             const label nPoints
126         );
128         //- Construct from dictionary
129         uniformSet
130         (
131             const word& name,
132             const polyMesh& mesh,
133             meshSearch& searchEngine,
134             const dictionary& dict
135         );
138     //- Destructor
139     virtual ~uniformSet();
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace Foam
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 #endif
151 // ************************************************************************* //