FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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. Uses ExactParticle tracking class so
30  will work on concave cells.
31 
32 SourceFiles
33  trackedParticle.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef trackedParticle_H
38 #define trackedParticle_H
39 
40 #include "ExactParticle.H"
41 #include <OpenFOAM/autoPtr.H>
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 class trackedParticleCloud;
49 
50 /*---------------------------------------------------------------------------*\
51  Class trackedParticle Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public ExactParticle<trackedParticle>
57 {
58  // Private data
59 
60  //- end point to track to
61  point end_;
62 
63  //- level of this particle
64  label level_;
65 
66  //- passive label
67  label i_;
68 
69  //- passive label
70  label j_;
71 
72 public:
73 
74  friend class Cloud<trackedParticle>;
75 
76  //- Class used to pass tracking data to the trackToFace function
77  class trackData
78  {
79  //- Reference to the cloud containing this particle
80  Cloud<trackedParticle>& cloud_;
81 
82  labelList& maxLevel_;
83 
84  public:
85 
88 
89 
90  // Constructors
91 
93  :
94  cloud_(cloud),
95  maxLevel_(maxLevel)
96  {}
97 
98 
99  // Member functions
100 
102  {
103  return cloud_;
104  }
105 
107  {
108  return maxLevel_;
109  }
110  };
111 
112 
113 
114  // Constructors
115 
116  //- Construct from components
118  (
119  const Cloud<trackedParticle>& c,
120  const vector& position,
121  const label celli,
122  const point& end,
123  const label level,
124  const label i,
125  const label j
126  );
127 
128  //- Construct from Istream
130  (
131  const Cloud<trackedParticle>& c,
132  Istream& is,
133  bool readFields = true
134  );
135 
136  //- Construct and return a clone
138  {
139  return autoPtr<trackedParticle>(new trackedParticle(*this));
140  }
141 
142 
143  // Member Functions
144 
145  //- point to track to
147  {
148  return end_;
149  }
150 
151  //- transported label
152  label& i()
153  {
154  return i_;
155  }
156 
157  //- transported label
158  label& j()
159  {
160  return j_;
161  }
162 
163 
164 
165  // Tracking
166 
167  //- Track all particles to their end point
168  bool move(trackData&);
169 
170 
171  //- Overridable function to handle the particle hitting a patch
172  // Executed before other patch-hitting functions
173  bool hitPatch
174  (
175  const polyPatch&,
177  const label patchI
178  );
179  bool hitPatch
180  (
181  const polyPatch&,
182  int&,
183  const label patchI
184  );
185 
186  //- Overridable function to handle the particle hitting a wedge
187  void hitWedgePatch
188  (
189  const wedgePolyPatch&,
191  );
192  void hitWedgePatch
193  (
194  const wedgePolyPatch&,
195  int&
196  );
197 
198  //- Overridable function to handle the particle hitting a
199  // symmetryPlane
200  void hitSymmetryPatch
201  (
202  const symmetryPolyPatch&,
204  );
205  void hitSymmetryPatch
206  (
207  const symmetryPolyPatch&,
208  int&
209  );
210 
211  //- Overridable function to handle the particle hitting a cyclic
212  void hitCyclicPatch
213  (
214  const cyclicPolyPatch&,
216  );
217  void hitCyclicPatch
218  (
219  const cyclicPolyPatch&,
220  int&
221  );
222 
223  //- Overridable function to handle the particle hitting a
224  //- processorPatch
225  void hitProcessorPatch
226  (
227  const processorPolyPatch&,
229  );
230  void hitProcessorPatch
231  (
232  const processorPolyPatch&,
233  int&
234  );
235 
236  //- Overridable function to handle the particle hitting a wallPatch
237  void hitWallPatch
238  (
239  const wallPolyPatch&,
241  );
242  void hitWallPatch
243  (
244  const wallPolyPatch&,
245  int&
246  );
247 
248  //- Overridable function to handle the particle hitting a polyPatch
249  void hitPatch
250  (
251  const polyPatch&,
253  );
254  void hitPatch
255  (
256  const polyPatch&,
257  int&
258  );
259 
260 
261  // Ostream Operator
262 
263  friend Ostream& operator<<(Ostream&, const trackedParticle&);
264 
265 
266 };
267 
268 
269 template<>
271 {
272  return true;
273 }
274 
275 //template<>
276 //void Cloud<trackedParticle>::readFields();
277 //
278 //template<>
279 //void Cloud<trackedParticle>::writeFields() const;
280 
281 
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 
284 } // End namespace Foam
285 
286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 
288 #endif
289 
290 // ************************ vim: set sw=4 sts=4 et: ************************ //