OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

trackedParticle.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::trackedParticle
00027 
00028 Description
00029     Particle class that marks cells it passes through. Used to mark cells
00030     visited by feature edges. Uses ExactParticle tracking class so
00031     will work on concave cells.
00032 
00033 SourceFiles
00034     trackedParticle.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef trackedParticle_H
00039 #define trackedParticle_H
00040 
00041 #include "ExactParticle.H"
00042 #include "autoPtr.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 class trackedParticleCloud;
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class trackedParticle Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class trackedParticle
00056 :
00057     public ExactParticle<trackedParticle>
00058 {
00059     // Private data
00060 
00061         //- end point to track to
00062         point end_;
00063 
00064         //- level of this particle
00065         label level_;
00066 
00067         //- passive label
00068         label i_;
00069 
00070         //- passive label
00071         label j_;
00072 
00073 public:
00074 
00075     friend class Cloud<trackedParticle>;
00076 
00077     //- Class used to pass tracking data to the trackToFace function
00078     class trackData
00079     {
00080         //- Reference to the cloud containing this particle
00081         Cloud<trackedParticle>& cloud_;
00082 
00083         labelList& maxLevel_;
00084 
00085     public:
00086 
00087         bool switchProcessor;
00088         bool keepParticle;
00089 
00090 
00091         // Constructors
00092 
00093             trackData(Cloud<trackedParticle>& cloud, labelList& maxLevel)
00094             :
00095                 cloud_(cloud),
00096                 maxLevel_(maxLevel)
00097             {}
00098 
00099 
00100         // Member functions
00101 
00102             Cloud<trackedParticle>& cloud()
00103             {
00104                 return cloud_;
00105             }
00106 
00107             labelList& maxLevel()
00108             {
00109                 return maxLevel_;
00110             }
00111     };
00112 
00113 
00114 
00115     // Constructors
00116 
00117         //- Construct from components
00118         trackedParticle
00119         (
00120             const Cloud<trackedParticle>& c,
00121             const vector& position,
00122             const label celli,
00123             const point& end,
00124             const label level,
00125             const label i,
00126             const label j
00127         );
00128 
00129         //- Construct from Istream
00130         trackedParticle
00131         (
00132             const Cloud<trackedParticle>& c,
00133             Istream& is,
00134             bool readFields = true
00135         );
00136 
00137         //- Construct and return a clone
00138         autoPtr<trackedParticle> clone() const
00139         {
00140             return autoPtr<trackedParticle>(new trackedParticle(*this));
00141         }
00142 
00143 
00144     // Member Functions
00145 
00146         //- point to track to
00147         point& end()
00148         {
00149             return end_;
00150         }
00151 
00152         //- transported label
00153         label& i()
00154         {
00155             return i_;
00156         }
00157 
00158         //- transported label
00159         label& j()
00160         {
00161             return j_;
00162         }
00163 
00164 
00165 
00166         // Tracking
00167 
00168             //- Track all particles to their end point
00169             bool move(trackData&);
00170 
00171 
00172             //- Overridable function to handle the particle hitting a patch
00173             //  Executed before other patch-hitting functions
00174             bool hitPatch
00175             (
00176                 const polyPatch&,
00177                 trackedParticle::trackData& td,
00178                 const label patchI
00179             );
00180             bool hitPatch
00181             (
00182                 const polyPatch&,
00183                 int&,
00184                 const label patchI
00185            );
00186 
00187             //- Overridable function to handle the particle hitting a wedge
00188             void hitWedgePatch
00189             (
00190                 const wedgePolyPatch&,
00191                 trackedParticle::trackData& td
00192             );
00193             void hitWedgePatch
00194             (
00195                 const wedgePolyPatch&,
00196                 int&
00197             );
00198 
00199             //- Overridable function to handle the particle hitting a
00200             //  symmetryPlane
00201             void hitSymmetryPatch
00202             (
00203                 const symmetryPolyPatch&,
00204                 trackedParticle::trackData& td
00205             );
00206             void hitSymmetryPatch
00207             (
00208                 const symmetryPolyPatch&,
00209                 int&
00210             );
00211 
00212             //- Overridable function to handle the particle hitting a cyclic
00213             void hitCyclicPatch
00214             (
00215                 const cyclicPolyPatch&,
00216                 trackedParticle::trackData& td
00217             );
00218             void hitCyclicPatch
00219             (
00220                 const cyclicPolyPatch&,
00221                 int&
00222             );
00223 
00224             //- Overridable function to handle the particle hitting a
00225             //- processorPatch
00226             void hitProcessorPatch
00227             (
00228                 const processorPolyPatch&,
00229                 trackedParticle::trackData& td
00230             );
00231             void hitProcessorPatch
00232             (
00233                 const processorPolyPatch&,
00234                 int&
00235             );
00236 
00237             //- Overridable function to handle the particle hitting a wallPatch
00238             void hitWallPatch
00239             (
00240                 const wallPolyPatch&,
00241                 trackedParticle::trackData& td
00242             );
00243             void hitWallPatch
00244             (
00245                 const wallPolyPatch&,
00246                 int&
00247             );
00248 
00249             //- Overridable function to handle the particle hitting a polyPatch
00250             void hitPatch
00251             (
00252                 const polyPatch&,
00253                 trackedParticle::trackData& td
00254             );
00255             void hitPatch
00256             (
00257                 const polyPatch&,
00258                 int&
00259             );
00260 
00261 
00262     // Ostream Operator
00263 
00264         friend Ostream& operator<<(Ostream&, const trackedParticle&);
00265 
00266 
00267 };
00268 
00269 
00270 template<>
00271 inline bool contiguous<trackedParticle>()
00272 {
00273     return true;
00274 }
00275 
00276 //template<>
00277 //void Cloud<trackedParticle>::readFields();
00278 //
00279 //template<>
00280 //void Cloud<trackedParticle>::writeFields() const;
00281 
00282 
00283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00284 
00285 } // End namespace Foam
00286 
00287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00288 
00289 #endif
00290 
00291 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd