trackedParticle.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-2017 OpenFOAM Foundation
9 Copyright (C) 2017-2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::trackedParticle
29
30Description
31 Particle class that marks cells it passes through. Used to mark cells
32 visited by feature edges.
33
34SourceFiles
35 trackedParticle.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef trackedParticle_H
40#define trackedParticle_H
41
42#include "bitSet.H"
43#include "particle.H"
44#include "autoPtr.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52
53class trackedParticleCloud;
54class trackedParticle;
55
56Ostream& operator<<(Ostream&, const trackedParticle&);
57
58
59/*---------------------------------------------------------------------------*\
60 Class trackedParticle Declaration
61\*---------------------------------------------------------------------------*/
64:
65 public particle
66{
67 // Private data
68
69 //- Start point to track from
70 point start_;
71
72 //- End point to track to
73 point end_;
74
75 //- Level of this particle
76 label level_;
77
78 //- Passive label (used to store feature edge mesh)
79 label i_;
80
81 //- Passive label (used to store feature edge point)
82 label j_;
83
84 //- Passive label (used to store feature edge label)
85 label k_;
86
87
88public:
89
90 friend class Cloud<trackedParticle>;
91
92 //- Class used to pass tracking data to the trackToFace function
93 class trackingData
94 :
96 {
97 public:
102
103
104 // Constructors
107 (
109 labelList& maxLevel,
110 List<bitSet>& featureEdgeVisited
111 )
112 :
114 maxLevel_(maxLevel),
115 featureEdgeVisited_(featureEdgeVisited)
116 {}
117
118 };
119
120
121 // Static Data Members
122
123 //- Size in bytes of the fields
124 static const std::size_t sizeofFields_;
125
126
127 // Constructors
128
129 //- Construct from components
131 (
132 const polyMesh& mesh,
134 const label celli,
135 const label tetFacei,
136 const label tetPtI,
137 const point& end,
138 const label level,
139 const label i,
140 const label j,
141 const label k
142 );
143
144 //- Construct from a position and a cell, searching for the rest of the
145 // required topology
147 (
148 const polyMesh& mesh,
149 const vector& position,
150 const label celli,
151 const point& end,
152 const label level,
153 const label i,
154 const label j,
155 const label k
156 );
157
158 //- Construct from Istream
160 (
161 const polyMesh& mesh,
162 Istream& is,
163 bool readFields = true,
164 bool newFormat = true
165 );
166
167 //- Construct and return a clone
169 {
171 }
172
173 //- Factory class to read-construct particles used for
174 // parallel transfer
175 class iNew
176 {
177 const polyMesh& mesh_;
178
179 public:
181 iNew(const polyMesh& mesh)
182 :
183 mesh_(mesh)
184 {}
187 {
188 return autoPtr<trackedParticle>::New(mesh_, is, true);
189 }
190 };
191
192
193 // Member Functions
194
195 //- Point to track from
196 point& start()
197 {
198 return start_;
199 }
200
201 //- Point to track to
202 point& end()
203 {
204 return end_;
205 }
206
207 //- Transported label
208 label i() const
209 {
210 return i_;
211 }
212
213 //- Transported label
214 label& i()
215 {
216 return i_;
217 }
218
219 //- Transported label
220 label j() const
221 {
222 return j_;
223 }
224
225 //- Transported label
226 label& j()
227 {
228 return j_;
229 }
230
231 //- Transported label
232 label k() const
233 {
234 return k_;
235 }
236
237 //- Transported label
238 label& k()
239 {
240 return k_;
241 }
242
243
244
245 // Tracking
246
247 //- Track all particles to their end point
248 bool move(Cloud<trackedParticle>&, trackingData&, const scalar);
249
250 //- Overridable function to handle the particle hitting a patch
251 // Executed before other patch-hitting functions
252 bool hitPatch(Cloud<trackedParticle>&, trackingData&);
253
254 //- Overridable function to handle the particle hitting a wedge
255 void hitWedgePatch(Cloud<trackedParticle>&, trackingData&);
256
257 //- Overridable function to handle the particle hitting a
258 // symmetry plane
259 void hitSymmetryPlanePatch(Cloud<trackedParticle>&, trackingData&);
260
261 //- Overridable function to handle the particle hitting a
262 // symmetry patch
263 void hitSymmetryPatch(Cloud<trackedParticle>&, trackingData&);
264
265 //- Overridable function to handle the particle hitting a cyclic
266 void hitCyclicPatch(Cloud<trackedParticle>&, trackingData&);
267
268 //- Overridable function to handle the particle hitting a cyclicAMI
270 (
272 trackingData&,
273 const vector&
274 );
275
276 //- Overridable function to handle the particle hitting a cyclicACMI
278 (
280 trackingData&,
281 const vector&
282 );
283
284 //- Overridable function to handle the particle hitting a
285 //- processorPatch
286 void hitProcessorPatch(Cloud<trackedParticle>&, trackingData&);
287
288 //- Overridable function to handle the particle hitting a wallPatch
289 void hitWallPatch(Cloud<trackedParticle>&, trackingData&);
290
291 //- Convert processor patch addressing to the global equivalents
292 // and set the celli to the face-neighbour
293 void correctAfterParallelTransfer(const label, trackingData&);
294
295
296 // Ostream Operator
298 friend Ostream& operator<<(Ostream&, const trackedParticle&);
299};
300
301
302// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
303
304//- Contiguous data for trackedParticle
305template<> struct is_contiguous<trackedParticle> : std::true_type {};
306
307
308// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
309
310} // End namespace Foam
311
312// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313
314#endif
315
316// ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:68
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
Base particle class.
Definition: particle.H:79
vector position() const
Return current particle position.
Definition: particleI.H:314
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition: particleI.H:137
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition: particleI.H:143
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Factory class to read-construct particles used for.
iNew(const polyMesh &mesh)
autoPtr< trackedParticle > operator()(Istream &is) const
Class used to pass tracking data to the trackToFace function.
trackingData(Cloud< trackedParticle > &cloud, labelList &maxLevel, List< bitSet > &featureEdgeVisited)
Particle class that marks cells it passes through. Used to mark cells visited by feature edges.
void correctAfterParallelTransfer(const label, trackingData &)
Convert processor patch addressing to the global equivalents.
void hitWedgePatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
point & start()
Point to track from.
bool hitPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a patch.
autoPtr< particle > clone() const
Construct and return a clone.
label & j()
Transported label.
label & i()
Transported label.
label j() const
Transported label.
bool move(Cloud< trackedParticle > &, trackingData &, const scalar)
Track all particles to their end point.
void hitSymmetryPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
void hitSymmetryPlanePatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
label i() const
Transported label.
void hitWallPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
friend Ostream & operator<<(Ostream &, const trackedParticle &)
static const std::size_t sizeofFields_
Size in bytes of the fields.
void hitCyclicACMIPatch(Cloud< trackedParticle > &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicACMI.
point & end()
Point to track to.
void hitCyclicPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
void hitProcessorPatch(Cloud< trackedParticle > &, trackingData &)
void hitCyclicAMIPatch(Cloud< trackedParticle > &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicAMI.
label & k()
Transported label.
label k() const
Transported label.
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78