FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::trackedParticle
00026 
00027 Description
00028     Particle class that marks cells it passes through. Used to mark cells
00029     visited by feature edges. Uses ExactParticle tracking class so
00030     will work on concave cells.
00031 
00032 SourceFiles
00033     trackedParticle.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef trackedParticle_H
00038 #define trackedParticle_H
00039 
00040 #include "ExactParticle.H"
00041 #include <OpenFOAM/autoPtr.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 class trackedParticleCloud;
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class trackedParticle Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 class trackedParticle
00055 :
00056     public ExactParticle<trackedParticle>
00057 {
00058     // Private data
00059 
00060         //- end point to track to
00061         point end_;
00062 
00063         //- level of this particle
00064         label level_;
00065 
00066         //- passive label
00067         label i_;
00068 
00069         //- passive label
00070         label j_;
00071 
00072 public:
00073 
00074     friend class Cloud<trackedParticle>;
00075 
00076     //- Class used to pass tracking data to the trackToFace function
00077     class trackData
00078     {
00079         //- Reference to the cloud containing this particle
00080         Cloud<trackedParticle>& cloud_;
00081 
00082         labelList& maxLevel_;
00083 
00084     public:
00085 
00086         bool switchProcessor;
00087         bool keepParticle;
00088 
00089 
00090         // Constructors
00091 
00092             trackData(Cloud<trackedParticle>& cloud, labelList& maxLevel)
00093             :
00094                 cloud_(cloud),
00095                 maxLevel_(maxLevel)
00096             {}
00097 
00098 
00099         // Member functions
00100 
00101             Cloud<trackedParticle>& cloud()
00102             {
00103                 return cloud_;
00104             }
00105 
00106             labelList& maxLevel()
00107             {
00108                 return maxLevel_;
00109             }
00110     };
00111 
00112 
00113 
00114     // Constructors
00115 
00116         //- Construct from components
00117         trackedParticle
00118         (
00119             const Cloud<trackedParticle>& c,
00120             const vector& position,
00121             const label celli,
00122             const point& end,
00123             const label level,
00124             const label i,
00125             const label j
00126         );
00127 
00128         //- Construct from Istream
00129         trackedParticle
00130         (
00131             const Cloud<trackedParticle>& c,
00132             Istream& is,
00133             bool readFields = true
00134         );
00135 
00136         //- Construct and return a clone
00137         autoPtr<trackedParticle> clone() const
00138         {
00139             return autoPtr<trackedParticle>(new trackedParticle(*this));
00140         }
00141 
00142 
00143     // Member Functions
00144 
00145         //- point to track to
00146         point& end()
00147         {
00148             return end_;
00149         }
00150 
00151         //- transported label
00152         label& i()
00153         {
00154             return i_;
00155         }
00156 
00157         //- transported label
00158         label& j()
00159         {
00160             return j_;
00161         }
00162 
00163 
00164 
00165         // Tracking
00166 
00167             //- Track all particles to their end point
00168             bool move(trackData&);
00169 
00170 
00171             //- Overridable function to handle the particle hitting a patch
00172             //  Executed before other patch-hitting functions
00173             bool hitPatch
00174             (
00175                 const polyPatch&,
00176                 trackedParticle::trackData& td,
00177                 const label patchI
00178             );
00179             bool hitPatch
00180             (
00181                 const polyPatch&,
00182                 int&,
00183                 const label patchI
00184            );
00185 
00186             //- Overridable function to handle the particle hitting a wedge
00187             void hitWedgePatch
00188             (
00189                 const wedgePolyPatch&,
00190                 trackedParticle::trackData& td
00191             );
00192             void hitWedgePatch
00193             (
00194                 const wedgePolyPatch&,
00195                 int&
00196             );
00197 
00198             //- Overridable function to handle the particle hitting a
00199             //  symmetryPlane
00200             void hitSymmetryPatch
00201             (
00202                 const symmetryPolyPatch&,
00203                 trackedParticle::trackData& td
00204             );
00205             void hitSymmetryPatch
00206             (
00207                 const symmetryPolyPatch&,
00208                 int&
00209             );
00210 
00211             //- Overridable function to handle the particle hitting a cyclic
00212             void hitCyclicPatch
00213             (
00214                 const cyclicPolyPatch&,
00215                 trackedParticle::trackData& td
00216             );
00217             void hitCyclicPatch
00218             (
00219                 const cyclicPolyPatch&,
00220                 int&
00221             );
00222 
00223             //- Overridable function to handle the particle hitting a
00224             //- processorPatch
00225             void hitProcessorPatch
00226             (
00227                 const processorPolyPatch&,
00228                 trackedParticle::trackData& td
00229             );
00230             void hitProcessorPatch
00231             (
00232                 const processorPolyPatch&,
00233                 int&
00234             );
00235 
00236             //- Overridable function to handle the particle hitting a wallPatch
00237             void hitWallPatch
00238             (
00239                 const wallPolyPatch&,
00240                 trackedParticle::trackData& td
00241             );
00242             void hitWallPatch
00243             (
00244                 const wallPolyPatch&,
00245                 int&
00246             );
00247 
00248             //- Overridable function to handle the particle hitting a polyPatch
00249             void hitPatch
00250             (
00251                 const polyPatch&,
00252                 trackedParticle::trackData& td
00253             );
00254             void hitPatch
00255             (
00256                 const polyPatch&,
00257                 int&
00258             );
00259 
00260 
00261     // Ostream Operator
00262 
00263         friend Ostream& operator<<(Ostream&, const trackedParticle&);
00264 
00265 
00266 };
00267 
00268 
00269 template<>
00270 inline bool contiguous<trackedParticle>()
00271 {
00272     return true;
00273 }
00274 
00275 //template<>
00276 //void Cloud<trackedParticle>::readFields();
00277 //
00278 //template<>
00279 //void Cloud<trackedParticle>::writeFields() const;
00280 
00281 
00282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00283 
00284 } // End namespace Foam
00285 
00286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00287 
00288 #endif
00289 
00290 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines