initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / autoMesh / autoHexMesh / trackedParticle / trackedParticle.H
blob3e2d12a1d2f16b84b3881883a7813d40a9026ec6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::trackedParticle
28 Description
29     Particle class that marks cells it passes through. Used to mark cells
30     visited by feature edges. Uses ExactParticle tracking class so
31     will work on concave cells.
33 SourceFiles
34     trackedParticle.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef trackedParticle_H
39 #define trackedParticle_H
41 #include "ExactParticle.H"
42 #include "autoPtr.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 class trackedParticleCloud;
51 /*---------------------------------------------------------------------------*\
52                            Class trackedParticle Declaration
53 \*---------------------------------------------------------------------------*/
55 class trackedParticle
57     public ExactParticle<trackedParticle>
59     // Private data
61         //- end point to track to
62         point end_;
64         //- level of this particle
65         label level_;
67         //- passive label
68         label i_;
70         //- passive label
71         label j_;
73 public:
75     friend class Cloud<trackedParticle>;
77     //- Class used to pass tracking data to the trackToFace function
78     class trackData
79     {
80         //- Reference to the cloud containing this particle
81         Cloud<trackedParticle>& cloud_;
83         labelList& maxLevel_;
85     public:
87         bool switchProcessor;
88         bool keepParticle;
91         // Constructors
93             trackData(Cloud<trackedParticle>& cloud, labelList& maxLevel)
94             :
95                 cloud_(cloud),
96                 maxLevel_(maxLevel)
97             {}
100         // Member functions
102             Cloud<trackedParticle>& cloud()
103             {
104                 return cloud_;
105             }
107             labelList& maxLevel()
108             {
109                 return maxLevel_;
110             }
111     };
115     // Constructors
117         //- Construct from components
118         trackedParticle
119         (
120             const Cloud<trackedParticle>& c,
121             const vector& position,
122             const label celli,
123             const point& end,
124             const label level,
125             const label i,
126             const label j
127         );
129         //- Construct from Istream
130         trackedParticle
131         (
132             const Cloud<trackedParticle>& c,
133             Istream& is,
134             bool readFields = true
135         );
137         //- Construct and return a clone
138         autoPtr<trackedParticle> clone() const
139         {
140             return autoPtr<trackedParticle>(new trackedParticle(*this));
141         }
144     // Member Functions
146         //- point to track to
147         point& end()
148         {
149             return end_;
150         }
152         //- transported label
153         label& i()
154         {
155             return i_;
156         }
158         //- transported label
159         label& j()
160         {
161             return j_;
162         }
166         // Tracking
168             //- Track all particles to their end point
169             bool move(trackData&);
172             //- Overridable function to handle the particle hitting a patch
173             //  Executed before other patch-hitting functions
174             bool hitPatch
175             (
176                 const polyPatch&,
177                 trackedParticle::trackData& td,
178                 const label patchI
179             );
180             bool hitPatch
181             (
182                 const polyPatch&,
183                 int&,
184                 const label patchI
185            );
187             //- Overridable function to handle the particle hitting a wedge
188             void hitWedgePatch
189             (
190                 const wedgePolyPatch&,
191                 trackedParticle::trackData& td
192             );
193             void hitWedgePatch
194             (
195                 const wedgePolyPatch&,
196                 int&
197             );
199             //- Overridable function to handle the particle hitting a
200             //  symmetryPlane
201             void hitSymmetryPatch
202             (
203                 const symmetryPolyPatch&,
204                 trackedParticle::trackData& td
205             );
206             void hitSymmetryPatch
207             (
208                 const symmetryPolyPatch&,
209                 int&
210             );
212             //- Overridable function to handle the particle hitting a cyclic
213             void hitCyclicPatch
214             (
215                 const cyclicPolyPatch&,
216                 trackedParticle::trackData& td
217             );
218             void hitCyclicPatch
219             (
220                 const cyclicPolyPatch&,
221                 int&
222             );
224             //- Overridable function to handle the particle hitting a
225             //- processorPatch
226             void hitProcessorPatch
227             (
228                 const processorPolyPatch&,
229                 trackedParticle::trackData& td
230             );
231             void hitProcessorPatch
232             (
233                 const processorPolyPatch&,
234                 int&
235             );
237             //- Overridable function to handle the particle hitting a wallPatch
238             void hitWallPatch
239             (
240                 const wallPolyPatch&,
241                 trackedParticle::trackData& td
242             );
243             void hitWallPatch
244             (
245                 const wallPolyPatch&,
246                 int&
247             );
249             //- Overridable function to handle the particle hitting a polyPatch
250             void hitPatch
251             (
252                 const polyPatch&,
253                 trackedParticle::trackData& td
254             );
255             void hitPatch
256             (
257                 const polyPatch&,
258                 int&
259             );
262     // Ostream Operator
264         friend Ostream& operator<<(Ostream&, const trackedParticle&);
270 template<>
271 inline bool contiguous<trackedParticle>()
273     return true;
276 //template<>
277 //void Cloud<trackedParticle>::readFields();
279 //template<>
280 //void Cloud<trackedParticle>::writeFields() const;
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 } // End namespace Foam
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289 #endif
291 // ************************************************************************* //