All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2020 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 class trackedParticleCloud;
49 
50 
51 // Forward declaration of friend functions and operators
52 
53 class trackedParticle;
54 
55 Ostream& operator<<(Ostream&, const trackedParticle&);
56 
57 
58 /*---------------------------------------------------------------------------*\
59  Class trackedParticle Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class trackedParticle
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 
87 public:
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 
101 
102 
103  // Constructors
104 
106  (
108  labelList& maxLevel,
109  List<PackedBoolList>& featureEdgeVisited
110  )
111  :
112  particle::trackingData(cloud),
113  maxLevel_(maxLevel),
114  featureEdgeVisited_(featureEdgeVisited)
115  {}
116 
117  };
118 
119 
120 
121  // Constructors
122 
123  //- Construct from components
125  (
126  const polyMesh& mesh,
127  const barycentric& coordinates,
128  const label celli,
129  const label tetFacei,
130  const label tetPtI,
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 a position and a cell, searching for the rest of the
139  // required topology
141  (
142  const polyMesh& mesh,
143  const vector& position,
144  const label celli,
145  const point& end,
146  const label level,
147  const label i,
148  const label j,
149  const label k
150  );
151 
152  //- Construct from Istream
154  (
155  const polyMesh& mesh,
156  Istream& is,
157  bool readFields = true
158  );
159 
160  //- Construct and return a clone
161  autoPtr<particle> clone() const
162  {
163  return autoPtr<particle>(new trackedParticle(*this));
164  }
165 
166  //- Factory class to read-construct particles used for
167  // parallel transfer
168  class iNew
169  {
170  const polyMesh& mesh_;
171 
172  public:
174  iNew(const polyMesh& mesh)
175  :
176  mesh_(mesh)
177  {}
179  autoPtr<trackedParticle> operator()(Istream& is) const
180  {
182  (
183  new trackedParticle(mesh_, is, true)
184  );
185  }
186  };
187 
188 
189  // Member Functions
190 
191  //- Point to track from
192  point& start()
193  {
194  return start_;
195  }
196 
197  //- Point to track to
198  point& end()
199  {
200  return end_;
201  }
202 
203  //- Transported label
204  label i() const
205  {
206  return i_;
207  }
208 
209  //- Transported label
210  label& i()
211  {
212  return i_;
213  }
214 
215  //- Transported label
216  label j() const
217  {
218  return j_;
219  }
220 
221  //- Transported label
222  label& j()
223  {
224  return j_;
225  }
226 
227  //- Transported label
228  label k() const
229  {
230  return k_;
231  }
232 
233  //- Transported label
234  label& k()
235  {
236  return k_;
237  }
238 
239 
240 
241  // Tracking
242 
243  //- Track all particles to their end point
244  bool move(Cloud<trackedParticle>&, trackingData&, const scalar);
245 
246  //- Overridable function to handle the particle hitting a patch
247  // Executed before other patch-hitting functions
249 
250  //- Overridable function to handle the particle hitting a wedge
252 
253  //- Overridable function to handle the particle hitting a
254  // symmetry plane
256 
257  //- Overridable function to handle the particle hitting a
258  // symmetry patch
260 
261  //- Overridable function to handle the particle hitting a cyclic
263 
264  //- Overridable function to handle the particle hitting a cyclicAMI
265  void hitCyclicAMIPatch
266  (
267  const vector&,
268  const scalar,
270  trackingData&
271  );
272 
273  //- Overridable function to handle the particle hitting a cyclicACMI
274  void hitCyclicACMIPatch
275  (
276  const vector&,
277  const scalar,
279  trackingData&
280  );
281 
282  //- Overridable function to handle the particle hitting a
283  // cyclicRepeatAMI
285  (
286  const vector&,
287  const scalar,
289  trackingData&
290  );
291 
292  //- Overridable function to handle the particle hitting a
293  //- processorPatch
295 
296  //- Overridable function to handle the particle hitting a wallPatch
298 
299  //- Convert processor patch addressing to the global equivalents
300  // and set the celli to the face-neighbour
302 
303 
304  // Ostream Operator
305 
306  friend Ostream& operator<<(Ostream&, const trackedParticle&);
307 };
308 
309 
310 template<>
311 inline bool contiguous<trackedParticle>()
312 {
313  return true;
314 }
315 
316 //template<>
317 //void Cloud<trackedParticle>::readFields();
318 //
319 //template<>
320 //void Cloud<trackedParticle>::writeFields() const;
321 
322 
323 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
324 
325 } // End namespace Foam
326 
327 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
328 
329 #endif
330 
331 // ************************************************************************* //
void hitWallPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:125
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
void hitCyclicRepeatAMIPatch(const vector &, const scalar, Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
List< PackedBoolList > & featureEdgeVisited_
bool hitPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a patch.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
autoPtr< particle > clone() const
Construct and return a clone.
bool move(Cloud< trackedParticle > &, trackingData &, const scalar)
Track all particles to their end point.
Base particle class.
Definition: particle.H:83
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.
Particle class that marks cells it passes through. Used to mark cells visited by feature edges...
void hitSymmetryPlanePatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
point & end()
Point to track to.
void hitWedgePatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
point & start()
Point to track from.
label k() const
Transported label.
Factory class to read-construct particles used for.
Base cloud calls templated on particle type.
Definition: Cloud.H:52
bool contiguous< trackedParticle >()
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void correctAfterParallelTransfer(const label, trackingData &)
Convert processor patch addressing to the global equivalents.
void hitCyclicAMIPatch(const vector &, const scalar, Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclicAMI.
Class used to pass tracking data to the trackToFace function.
void hitSymmetryPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
void hitProcessorPatch(Cloud< trackedParticle > &, trackingData &)
label i() const
Transported label.
Ostream & operator<<(Ostream &, const ensightPart &)
void hitCyclicPatch(Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
void hitCyclicACMIPatch(const vector &, const scalar, Cloud< trackedParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclicACMI.
trackingData(Cloud< trackedParticle > &cloud, labelList &maxLevel, List< PackedBoolList > &featureEdgeVisited)
const barycentric & coordinates() const
Return current particle coordinates.
Definition: particleI.H:131
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
label j() const
Transported label.
friend Ostream & operator<<(Ostream &, const trackedParticle &)
vector position() const
Return current particle position.
Definition: particleI.H:278
Namespace for OpenFOAM.