initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / autoMesh / autoHexMesh / trackedParticle / trackedParticle.H
blobdc7c367aaa22b48c8cd2e418a01bf6c4aacce89f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 wedge
173             void hitWedgePatch
174             (
175                 const wedgePolyPatch&,
176                 trackedParticle::trackData& td
177             );
178             void hitWedgePatch
179             (
180                 const wedgePolyPatch&,
181                 int&
182             );
184             //- Overridable function to handle the particle hitting a
185             //  symmetryPlane
186             void hitSymmetryPatch
187             (
188                 const symmetryPolyPatch&,
189                 trackedParticle::trackData& td
190             );
191             void hitSymmetryPatch
192             (
193                 const symmetryPolyPatch&,
194                 int&
195             );
197             //- Overridable function to handle the particle hitting a cyclic
198             void hitCyclicPatch
199             (
200                 const cyclicPolyPatch&,
201                 trackedParticle::trackData& td
202             );
203             void hitCyclicPatch
204             (
205                 const cyclicPolyPatch&,
206                 int&
207             );
209             //- Overridable function to handle the particle hitting a
210             //- processorPatch
211             void hitProcessorPatch
212             (
213                 const processorPolyPatch&,
214                 trackedParticle::trackData& td
215             );
216             void hitProcessorPatch
217             (
218                 const processorPolyPatch&,
219                 int&
220             );
222             //- Overridable function to handle the particle hitting a wallPatch
223             void hitWallPatch
224             (
225                 const wallPolyPatch&,
226                 trackedParticle::trackData& td
227             );
228             void hitWallPatch
229             (
230                 const wallPolyPatch&,
231                 int&
232             );
234             //- Overridable function to handle the particle hitting a polyPatch
235             void hitPatch
236             (
237                 const polyPatch&,
238                 trackedParticle::trackData& td
239             );
240             void hitPatch
241             (
242                 const polyPatch&,
243                 int&
244             );
247     // Ostream Operator
249         friend Ostream& operator<<(Ostream&, const trackedParticle&);
255 template<>
256 inline bool contiguous<trackedParticle>()
258     return true;
261 //template<>
262 //void Cloud<trackedParticle>::readFields();
264 //template<>
265 //void Cloud<trackedParticle>::writeFields() const;
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 } // End namespace Foam
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 #endif
276 // ************************************************************************* //