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 | Copyright (C) 2011-2015 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 "autoPtr.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class trackedParticleCloud;
48 
49 /*---------------------------------------------------------------------------*\
50  Class trackedParticle Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class trackedParticle
54 :
55  public particle
56 {
57  // Private data
58 
59  //- End point to track to
60  point end_;
61 
62  //- Level of this particle
63  label level_;
64 
65  //- Passive label (used to store feature edge mesh)
66  label i_;
67 
68  //- Passive label (used to store feature edge point)
69  label j_;
70 
71  //- Passive label (used to store feature edge label)
72  label k_;
73 
74 
75 public:
76 
77  friend class Cloud<trackedParticle>;
78 
79  //- Class used to pass tracking data to the trackToFace function
80  class trackingData
81  :
82  public particle::TrackingData<Cloud<trackedParticle> >
83  {
84  public:
85 
87 
89 
90 
91  // Constructors
92 
94  (
96  labelList& maxLevel,
97  List<PackedBoolList>& featureEdgeVisited
98  )
99  :
101  maxLevel_(maxLevel),
102  featureEdgeVisited_(featureEdgeVisited)
103  {}
104 
105  };
106 
107 
108 
109  // Constructors
110 
111  //- Construct from components
113  (
114  const polyMesh& mesh,
115  const vector& position,
116  const label cellI,
117  const label tetFaceI,
118  const label tetPtI,
119  const point& end,
120  const label level,
121  const label i,
122  const label j,
123  const label k
124  );
125 
126  //- Construct from Istream
128  (
129  const polyMesh& mesh,
130  Istream& is,
131  bool readFields = true
132  );
133 
134  //- Construct and return a clone
135  autoPtr<particle> clone() const
136  {
137  return autoPtr<particle>(new trackedParticle(*this));
138  }
139 
140  //- Factory class to read-construct particles used for
141  // parallel transfer
142  class iNew
143  {
144  const polyMesh& mesh_;
145 
146  public:
147 
148  iNew(const polyMesh& mesh)
149  :
150  mesh_(mesh)
151  {}
152 
154  {
156  (
157  new trackedParticle(mesh_, is, true)
158  );
159  }
160  };
161 
162 
163  // Member Functions
164 
165  //- Point to track to
166  point& end()
167  {
168  return end_;
169  }
170 
171  //- Transported label
172  label i() const
173  {
174  return i_;
175  }
176 
177  //- Transported label
178  label& i()
179  {
180  return i_;
181  }
182 
183  //- Transported label
184  label j() const
185  {
186  return j_;
187  }
188 
189  //- Transported label
190  label& j()
191  {
192  return j_;
193  }
194 
195  //- Transported label
196  label k() const
197  {
198  return k_;
199  }
200 
201  //- Transported label
202  label& k()
203  {
204  return k_;
205  }
206 
207 
208 
209  // Tracking
210 
211  //- Track all particles to their end point
212  bool move(trackingData&, const scalar);
213 
214 
215  //- Overridable function to handle the particle hitting a patch
216  // Executed before other patch-hitting functions
217  bool hitPatch
218  (
219  const polyPatch&,
220  trackingData& td,
221  const label patchI,
222  const scalar trackFraction,
223  const tetIndices& tetIs
224  );
225 
226  //- Overridable function to handle the particle hitting a wedge
227  void hitWedgePatch
228  (
229  const wedgePolyPatch&,
230  trackingData& td
231  );
232 
233  //- Overridable function to handle the particle hitting a
234  // symmetry plane
236  (
237  const symmetryPlanePolyPatch&,
238  trackingData& td
239  );
240 
241  //- Overridable function to handle the particle hitting a
242  // symmetry patch
243  void hitSymmetryPatch
244  (
245  const symmetryPolyPatch&,
246  trackingData& td
247  );
248 
249  //- Overridable function to handle the particle hitting a cyclic
250  void hitCyclicPatch
251  (
252  const cyclicPolyPatch&,
253  trackingData& td
254  );
255 
256  //- Overridable function to handle the particle hitting a
257  //- processorPatch
258  void hitProcessorPatch
259  (
260  const processorPolyPatch&,
261  trackingData& td
262  );
263 
264  //- Overridable function to handle the particle hitting a wallPatch
265  void hitWallPatch
266  (
267  const wallPolyPatch&,
268  trackingData& td,
269  const tetIndices&
270  );
271 
272  //- Overridable function to handle the particle hitting a polyPatch
273  void hitPatch
274  (
275  const polyPatch&,
276  trackingData& td
277  );
278 
279  //- Convert processor patch addressing to the global equivalents
280  // and set the cellI to the face-neighbour
281  void correctAfterParallelTransfer(const label, trackingData&);
282 
283 
284  // Ostream Operator
285 
286  friend Ostream& operator<<(Ostream&, const trackedParticle&);
287 };
288 
289 
290 template<>
291 inline bool contiguous<trackedParticle>()
292 {
293  return true;
294 }
295 
296 //template<>
297 //void Cloud<trackedParticle>::readFields();
298 //
299 //template<>
300 //void Cloud<trackedParticle>::writeFields() const;
301 
302 
303 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
304 
305 } // End namespace Foam
306 
307 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
308 
309 #endif
310 
311 // ************************************************************************* //
Foam::trackedParticle::hitProcessorPatch
void hitProcessorPatch(const processorPolyPatch &, trackingData &td)
Definition: trackedParticle.C:196
Foam::trackedParticle::trackingData
Class used to pass tracking data to the trackToFace function.
Definition: trackedParticle.H:79
Foam::trackedParticle::iNew::iNew
iNew(const polyMesh &mesh)
Definition: trackedParticle.H:147
Foam::trackedParticle::hitPatch
bool hitPatch(const polyPatch &, trackingData &td, const label patchI, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a patch.
Definition: trackedParticle.C:139
Foam::trackedParticle::trackingData::featureEdgeVisited_
List< PackedBoolList > & featureEdgeVisited_
Definition: trackedParticle.H:87
Foam::wedgePolyPatch
Wedge front and back plane patch.
Definition: wedgePolyPatch.H:48
Foam::cyclicPolyPatch
Cyclic plane patch.
Definition: cyclicPolyPatch.H:63
Foam::trackedParticle::i_
label i_
Passive label (used to store feature edge mesh)
Definition: trackedParticle.H:65
Foam::trackedParticle::clone
autoPtr< particle > clone() const
Construct and return a clone.
Definition: trackedParticle.H:134
Foam::trackedParticle::move
bool move(trackingData &, const scalar)
Track all particles to their end point.
Definition: trackedParticle.C:96
Foam::particle::TrackingData< Cloud< trackedParticle > >::cloud
Cloud< trackedParticle > & cloud()
Return a reference to the cloud.
Definition: particle.H:125
Foam::trackedParticle::k_
label k_
Passive label (used to store feature edge label)
Definition: trackedParticle.H:71
Foam::readFields
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:104
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::trackedParticle::j_
label j_
Passive label (used to store feature edge point)
Definition: trackedParticle.H:68
Foam::trackedParticle::hitSymmetryPatch
void hitSymmetryPatch(const symmetryPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: trackedParticle.C:174
Foam::trackedParticle::k
label & k()
Transported label.
Definition: trackedParticle.H:201
Foam::trackedParticle::k
label k() const
Transported label.
Definition: trackedParticle.H:195
Foam::trackedParticle::hitCyclicPatch
void hitCyclicPatch(const cyclicPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a cyclic.
Definition: trackedParticle.C:185
Foam::label
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
Foam::trackedParticle::i
label i() const
Transported label.
Definition: trackedParticle.H:171
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::trackedParticle::end
point & end()
Point to track to.
Definition: trackedParticle.H:165
Foam::symmetryPlanePolyPatch
Symmetry-plane patch.
Definition: symmetryPlanePolyPatch.H:48
Foam::symmetryPolyPatch
Symmetry patch for non-planar or multi-plane patches.
Definition: symmetryPolyPatch.H:51
Foam::trackedParticle::iNew
Factory class to read-construct particles used for.
Definition: trackedParticle.H:141
Foam::processorPolyPatch
Neighbour processor patch.
Definition: processorPolyPatch.H:55
Foam::particle::mesh
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:580
Foam::trackedParticle::trackingData::trackingData
trackingData(Cloud< trackedParticle > &cloud, labelList &maxLevel, List< PackedBoolList > &featureEdgeVisited)
Definition: trackedParticle.H:93
Foam::trackedParticle::i
label & i()
Transported label.
Definition: trackedParticle.H:177
Foam::trackedParticle::operator<<
friend Ostream & operator<<(Ostream &, const trackedParticle &)
Foam::trackedParticle::trackedParticle
trackedParticle(const polyMesh &mesh, const vector &position, 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.
Definition: trackedParticle.C:32
Foam::trackedParticle::trackingData::maxLevel_
labelList & maxLevel_
Definition: trackedParticle.H:85
Foam::wallPolyPatch
Foam::wallPolyPatch.
Definition: wallPolyPatch.H:48
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::trackedParticle::iNew::operator()
autoPtr< trackedParticle > operator()(Istream &is) const
Definition: trackedParticle.H:152
Foam::trackedParticle::j
label & j()
Transported label.
Definition: trackedParticle.H:189
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:73
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::cloud
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
Foam::trackedParticle::j
label j() const
Transported label.
Definition: trackedParticle.H:183
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::particle
Base particle class.
Definition: particle.H:78
Foam::Cloud
Base cloud calls templated on particle type.
Definition: Cloud.H:52
Foam::trackedParticle::hitWallPatch
void hitWallPatch(const wallPolyPatch &, trackingData &td, const tetIndices &)
Overridable function to handle the particle hitting a wallPatch.
Definition: trackedParticle.C:207
Foam::particle::position
const vector & position() const
Return current particle position.
Definition: particleI.H:586
particle.H
Foam::trackedParticle::hitWedgePatch
void hitWedgePatch(const wedgePolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a wedge.
Definition: trackedParticle.C:152
Foam::trackedParticle
Particle class that marks cells it passes through. Used to mark cells visited by feature edges.
Definition: trackedParticle.H:52
Foam::trackedParticle::hitSymmetryPlanePatch
void hitSymmetryPlanePatch(const symmetryPlanePolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: trackedParticle.C:163
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::trackedParticle::end_
point end_
End point to track to.
Definition: trackedParticle.H:59
Foam::particle::TrackingData
Definition: particle.H:94
Foam::trackedParticle::correctAfterParallelTransfer
void correctAfterParallelTransfer(const label, trackingData &)
Convert processor patch addressing to the global equivalents.
Definition: trackedParticle.C:230
Foam::contiguous< trackedParticle >
bool contiguous< trackedParticle >()
Definition: trackedParticle.H:290
Foam::trackedParticle::iNew::mesh_
const polyMesh & mesh_
Definition: trackedParticle.H:143
Foam::trackedParticle::level_
label level_
Level of this particle.
Definition: trackedParticle.H:62
autoPtr.H