Loading...
Searching...
No Matches
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-2024 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 Foam_trackedParticle_H
40#define Foam_trackedParticle_H
41
42#include "bitSet.H"
43#include "particle.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50// Forward Declarations
51
52class trackedParticleCloud;
53class trackedParticle;
54
56
58/*---------------------------------------------------------------------------*\
59 Class trackedParticle Declaration
60\*---------------------------------------------------------------------------*/
61
63:
64 public particle
65{
66 // Private Data
67
68 //- Start point to track from
69 point start_;
70
71 //- End point to track to
72 point end_;
73
74 //- Level of this particle
75 label level_;
76
77 //- Passive label (used to store feature edge mesh)
78 label i_;
79
80 //- Passive label (used to store feature edge point)
81 label j_;
82
83 //- Passive label (used to store feature edge label)
84 label k_;
85
86
87public:
88
89 friend class Cloud<trackedParticle>;
90
91 //- Class used to pass tracking data to the trackToFace function
92 class trackingData
93 :
95 {
96 public:
97
99
102
103 // Constructors
104
106 (
108 labelList& maxLevel,
109 List<bitSet>& featureEdgeVisited
110 )
111 :
113 maxLevel_(maxLevel),
114 featureEdgeVisited_(featureEdgeVisited)
115 {}
116
117 };
118
119
120 // Static Data Members
121
122 //- Size in bytes of the fields
123 static const std::size_t sizeofFields_;
124
125
126 // Constructors
127
128 //- Construct from components
130 (
131 const polyMesh& mesh,
133 const label celli,
134 const label tetFacei,
135 const label tetPtI,
136 const point& end,
137 const label level,
138 const label i,
139 const label j,
140 const label k
141 );
142
143 //- Construct from a position and a cell,
144 //- searching for the rest of the required topology
146 (
147 const polyMesh& mesh,
148 const vector& position,
149 const label celli,
150 const point& end,
151 const label level,
152 const label i,
153 const label j,
154 const label k
155 );
156
157 //- Construct from Istream
159 (
160 const polyMesh& mesh,
161 Istream& is,
162 bool readFields = true,
163 bool newFormat = true
164 );
165
166 //- Return a clone
167 virtual autoPtr<particle> clone() const
168 {
169 return particle::Clone(*this);
170 }
171
172 //- Factory class to read-construct particles (for parallel transfer)
173 class iNew
174 {
175 const polyMesh& mesh_;
176
177 public:
178
179 iNew(const polyMesh& mesh)
180 :
181 mesh_(mesh)
182 {}
183
184 autoPtr<trackedParticle> operator()(Istream& is) const
185 {
186 return autoPtr<trackedParticle>::New(mesh_, is, true);
187 }
188 };
189
190
191 // Member Functions
192
193 //- Point to track from
194 point& start() noexcept { return start_; }
195
196 //- Point to track to
197 point& end() noexcept { return end_; }
198
199 //- Transported label
200 label i() const noexcept { return i_; }
201
202 //- Transported label
203 label& i() noexcept { return i_; }
204
205 //- Transported label
206 label j() const noexcept { return j_; }
207
208 //- Transported label
209 label& j() noexcept { return j_; }
210
211 //- Transported label
212 label k() const noexcept { return k_; }
213
214 //- Transported label
215 label& k() noexcept { return k_; }
216
218
219 // Tracking
220
221 //- Track all particles to their end point
223
224 //- Overridable function to handle the particle hitting a patch
225 // Executed before other patch-hitting functions
228 //- Overridable function to handle the particle hitting a wedge
230
231 //- Overridable function to handle the particle hitting a
232 // symmetry plane
234
235 //- Overridable function to handle the particle hitting a
236 // symmetry patch
238
239 //- Overridable function to handle the particle hitting a cyclic
241
242 //- Overridable function to handle the particle hitting a cyclicAMI
244 (
247 const vector&
248 );
249
250 //- Overridable function to handle the particle hitting a cyclicACMI
255 const vector&
256 );
257
258 //- Overridable function to handle the particle hitting a
259 //- processorPatch
261
262 //- Overridable function to handle the particle hitting a wallPatch
264
265 //- Convert processor patch addressing to the global equivalents
266 // and set the celli to the face-neighbour
267 void correctAfterParallelTransfer(const label, trackingData&);
268
269
270 // Ostream Operator
271
272 friend Ostream& operator<<(Ostream&, const trackedParticle&);
273};
274
275
276// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
277
278//- Contiguous data for trackedParticle
279template<> struct is_contiguous<trackedParticle> : std::true_type {};
280
281
282// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283
284} // End namespace Foam
285
286// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287
288#endif
289
290// ************************************************************************* //
Base cloud calls templated on particle type.
Definition Cloud.H:64
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
A cloud is a registry collection of lagrangian particles.
Definition cloud.H:56
vector position() const
Return current particle position.
Definition particleI.H:283
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
static autoPtr< particle > Clone(const Derived &p)
Clone a particle.
Definition particle.H:552
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition particleI.H:110
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition particleI.H:116
particle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
Definition particle.C:507
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
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.
bool hitPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a patch.
label & k() noexcept
Transported label.
label & i() noexcept
Transported label.
label i() const noexcept
Transported label.
bool move(Cloud< trackedParticle > &, trackingData &, const scalar)
Track all particles to their end point.
virtual autoPtr< particle > clone() const
Return a clone.
point & end() noexcept
Point to track to.
void hitSymmetryPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
trackedParticle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPtI, const point &end, const label level, const label i, const label j, const label k)
Construct from components.
label & j() noexcept
Transported label.
void hitSymmetryPlanePatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
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.
label j() const noexcept
Transported label.
void hitCyclicPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
point & start() noexcept
Point to track from.
void hitProcessorPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a processorPatch.
label k() const noexcept
Transported label.
void hitCyclicAMIPatch(Cloud< trackedParticle > &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicAMI.
dynamicFvMesh & mesh
PtrList< coordinateSystem > coordinates(solidRegions.size())
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
vector point
Point is a vector.
Definition point.H:37
const direction noexcept
Definition scalarImpl.H:265
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
Definition barycentric.H:45
Vector< scalar > vector
Definition vector.H:57
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70