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-2022 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 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  const point& end,
131  const label level,
132  const label i,
133  const label j,
134  const label k
135  );
136 
137  //- Construct from Istream
138  trackedParticle(Istream& is, bool readFields = true);
139 
140  //- Construct and return a clone
141  autoPtr<particle> clone() const
142  {
143  return autoPtr<particle>(new trackedParticle(*this));
144  }
145 
146  //- Construct from Istream and return
148  {
150  }
151 
152 
153  // Member Functions
154 
155  //- Point to track from
156  point& start()
157  {
158  return start_;
159  }
160 
161  //- Point to track to
162  point& end()
163  {
164  return end_;
165  }
166 
167  //- Transported label
168  label i() const
169  {
170  return i_;
171  }
172 
173  //- Transported label
174  label& i()
175  {
176  return i_;
177  }
178 
179  //- Transported label
180  label j() const
181  {
182  return j_;
183  }
184 
185  //- Transported label
186  label& j()
187  {
188  return j_;
189  }
190 
191  //- Transported label
192  label k() const
193  {
194  return k_;
195  }
196 
197  //- Transported label
198  label& k()
199  {
200  return k_;
201  }
202 
203 
204 
205  // Tracking
206 
207  //- Track all particles to their end point
208  bool move(Cloud<trackedParticle>&, trackingData&);
209 
210  //- Overridable function to handle the particle hitting a wedge
211  void hitWedgePatch(Cloud<trackedParticle>&, trackingData&);
212 
213  //- Overridable function to handle the particle hitting a
214  // symmetry plane
215  void hitSymmetryPlanePatch(Cloud<trackedParticle>&, trackingData&);
216 
217  //- Overridable function to handle the particle hitting a
218  // symmetry patch
219  void hitSymmetryPatch(Cloud<trackedParticle>&, trackingData&);
220 
221  //- Overridable function to handle the particle hitting a cyclic
222  void hitCyclicPatch(Cloud<trackedParticle>&, trackingData&);
223 
224  //- Overridable function to handle the particle hitting a wallPatch
225  void hitWallPatch(Cloud<trackedParticle>&, trackingData&);
226 
227  //- Do corrections to the particle and tracking data following a
228  // transfer between processors
230  (
232  trackingData&
233  );
234 
235 
236  // Ostream Operator
237 
238  friend Ostream& operator<<(Ostream&, const trackedParticle&);
239 };
240 
241 
242 template<>
243 inline bool contiguous<trackedParticle>()
244 {
245  return true;
246 }
247 
248 //template<>
249 //void Cloud<trackedParticle>::readFields();
250 //
251 //template<>
252 //void Cloud<trackedParticle>::writeFields() const;
253 
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 } // End namespace Foam
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 #endif
262 
263 // ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:74
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
A cloud is a collection of lagrangian particles.
Definition: cloud.H:55
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:255
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class used to pass tracking data to the trackToFace function.
trackingData(Cloud< trackedParticle > &cloud, const scalar maxTrackLen, labelList &maxLevel, List< PackedBoolList > &featureEdgeVisited)
List< PackedBoolList > & featureEdgeVisited_
Particle class that marks cells it passes through. Used to mark cells visited by feature edges.
void hitWedgePatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
friend Ostream & operator<<(Ostream &, const trackedParticle &)
label j() const
Transported label.
point & start()
Point to track from.
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.
trackedParticle(const polyMesh &mesh, const vector &position, const label celli, 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.
label i() const
Transported label.
void hitWallPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
void correctAfterParallelTransfer(Cloud< trackedParticle > &, trackingData &)
Do corrections to the particle and tracking data following 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.
void hitCyclicPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
label k() const
Transported label.
bool move(Cloud< trackedParticle > &, trackingData &)
Track all particles to their end point.
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 &, const ensightPart &)