trackedParticle.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::trackedParticle
26 
27 Description
28  Particle class that marks cells it passes through. Used to mark cells
29  visited by feature edges.
30 
31 SourceFiles
32  trackedParticle.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef trackedParticle_H
37 #define trackedParticle_H
38 
39 #include "particle.H"
40 #include "Cloud.H"
41 #include "autoPtr.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of friend functions and operators
49 
50 class trackedParticle;
51 
52 Ostream& operator<<(Ostream&, const trackedParticle&);
53 
54 
55 /*---------------------------------------------------------------------------*\
56  Class trackedParticle Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class trackedParticle
60 :
61  public particle
62 {
63  // Private Data
64 
65  //- Start point to track from
66  point start_;
67 
68  //- End point to track to
69  point end_;
70 
71  //- Level of this particle
72  label level_;
73 
74  //- Passive label (used to store feature edge mesh)
75  label i_;
76 
77  //- Passive label (used to store feature edge point)
78  label j_;
79 
80  //- Passive label (used to store feature edge label)
81  label k_;
82 
83 
84 public:
85 
86  friend class lagrangian::Cloud<trackedParticle>;
87 
88  //- Class used to pass tracking data to the trackToFace function
89  class trackingData
90  :
92  {
93  public:
94 
95  const scalar maxTrackLen_;
96 
98 
100 
101 
102  // Constructors
103 
105  (
107  const scalar maxTrackLen,
108  labelList& maxLevel,
109  List<PackedBoolList>& featureEdgeVisited
110  )
111  :
113  maxTrackLen_(maxTrackLen),
114  maxLevel_(maxLevel),
115  featureEdgeVisited_(featureEdgeVisited)
116  {}
117  };
118 
119 
120 
121  // Constructors
122 
123  //- Construct from a position and a cell, searching for the rest of the
124  // required topology
126  (
127  const polyMesh& mesh,
128  const vector& position,
129  const label celli,
130  label& nLocateBoundaryHits,
131  const point& end,
132  const label level,
133  const label i,
134  const label j,
135  const label k
136  );
137 
138  //- Construct from Istream
139  trackedParticle(Istream& is, bool readFields = true);
140 
141  //- Construct and return a clone
142  autoPtr<particle> clone() const
143  {
144  return autoPtr<particle>(new trackedParticle(*this));
145  }
146 
147  //- Construct from Istream and return
149  {
151  }
152 
153 
154  // Member Functions
155 
156  //- Point to track from
157  point& start()
158  {
159  return start_;
160  }
161 
162  //- Point to track to
163  point& end()
164  {
165  return end_;
166  }
167 
168  //- Transported label
169  label i() const
170  {
171  return i_;
172  }
173 
174  //- Transported label
175  label& i()
176  {
177  return i_;
178  }
179 
180  //- Transported label
181  label j() const
182  {
183  return j_;
184  }
185 
186  //- Transported label
187  label& j()
188  {
189  return j_;
190  }
191 
192  //- Transported label
193  label k() const
194  {
195  return k_;
196  }
197 
198  //- Transported label
199  label& k()
200  {
201  return k_;
202  }
203 
204 
205 
206  // Tracking
207 
208  //- Track all particles to their end point
209  bool move(lagrangian::Cloud<trackedParticle>&, trackingData&);
210 
211  //- Overridable function to handle the particle hitting a wedge
212  void hitWedgePatch
213  (
215  trackingData&
216  );
217 
218  //- Overridable function to handle the particle hitting a
219  // symmetry plane
221  (
223  trackingData&
224  );
225 
226  //- Overridable function to handle the particle hitting a
227  // symmetry patch
228  void hitSymmetryPatch
229  (
231  trackingData&
232  );
233 
234  //- Overridable function to handle the particle hitting a cyclic
235  void hitCyclicPatch
236  (
238  trackingData&
239  );
240 
241  //- Overridable function to handle the particle hitting a wallPatch
242  void hitWallPatch
243  (
245  trackingData&
246  );
247 
248  //- Do corrections to the particle and tracking data following a
249  // transfer between processors
251  (
253  trackingData&
254  );
255 
256 
257  // Ostream Operator
258 
259  friend Ostream& operator<<(Ostream&, const trackedParticle&);
260 };
261 
262 
263 template<>
264 inline bool contiguous<trackedParticle>()
265 {
266  return true;
267 }
268 
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 } // End namespace Foam
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 #endif
277 
278 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:63
Base particle class.
Definition: particle.H:83
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
vector position(const polyMesh &mesh) const
Return current particle position.
Definition: particleI.H:159
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class used to pass tracking data to the trackToFace function.
List< PackedBoolList > & featureEdgeVisited_
trackingData(lagrangian::Cloud< trackedParticle > &cloud, const scalar maxTrackLen, labelList &maxLevel, List< PackedBoolList > &featureEdgeVisited)
Particle class that marks cells it passes through. Used to mark cells visited by feature edges.
void hitCyclicPatch(lagrangian::Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
void correctAfterParallelTransfer(lagrangian::Cloud< trackedParticle > &, trackingData &)
Do corrections to the particle and tracking data following a.
trackedParticle(const polyMesh &mesh, const vector &position, const label celli, label &nLocateBoundaryHits, const point &end, const label level, const label i, const label j, const label k)
Construct from a position and a cell, searching for the rest of the.
void hitWallPatch(lagrangian::Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
friend Ostream & operator<<(Ostream &, const trackedParticle &)
label j() const
Transported label.
point & start()
Point to track from.
void hitSymmetryPatch(lagrangian::Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
label i() const
Transported label.
void hitWedgePatch(lagrangian::Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
void hitSymmetryPlanePatch(lagrangian::Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
static autoPtr< trackedParticle > New(Istream &is)
Construct from Istream and return.
autoPtr< particle > clone() const
Construct and return a clone.
point & end()
Point to track to.
bool move(lagrangian::Cloud< trackedParticle > &, trackingData &)
Track all particles to their end point.
label k() const
Transported label.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
bool contiguous< trackedParticle >()
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)